summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManolo Carrasco <manolo@vaadin.com>2014-05-09 09:47:14 +0200
committerSauli Tähkäpää <sauli@vaadin.com>2014-05-22 11:32:28 +0300
commit7935bcc0912568717eb6f801d213986c689b1a21 (patch)
treedd5a9252ffabeb709625afe3e848d701d14d6d1e
parentfc6f45e09b089a6c5c2547cf6be8ae80937f5cf7 (diff)
downloadvaadin-framework-7935bcc0912568717eb6f801d213986c689b1a21.tar.gz
vaadin-framework-7935bcc0912568717eb6f801d213986c689b1a21.zip
Avoid Vaadin entry-point being run twice (#13730)
- Prevent bootstrap script fail if registerWidgetset is called twice with the same widgetset. Change-Id: I8b8069b442ea91c1aa0f0b7dd73c41902e75094b
-rw-r--r--WebContent/VAADIN/vaadinBootstrap.js15
-rw-r--r--client/src/com/vaadin/client/ApplicationConfiguration.java8
2 files changed, 17 insertions, 6 deletions
diff --git a/WebContent/VAADIN/vaadinBootstrap.js b/WebContent/VAADIN/vaadinBootstrap.js
index fc0fb9b948..ea1ea21b46 100644
--- a/WebContent/VAADIN/vaadinBootstrap.js
+++ b/WebContent/VAADIN/vaadinBootstrap.js
@@ -231,13 +231,16 @@
loadTheme: loadTheme,
registerWidgetset: function(widgetset, callback) {
log("Widgetset registered", widgetset);
- widgetsets[widgetset].callback = callback;
- for(var i = 0; i < widgetsets[widgetset].pendingApps.length; i++) {
- var appId = widgetsets[widgetset].pendingApps[i];
- log("Starting from register widgetset", appId);
- callback(appId);
+ var ws = widgetsets[widgetset];
+ if (ws && ws.pendingApps) {
+ ws.callback = callback;
+ for(var i = 0; i < ws.pendingApps.length; i++) {
+ var appId = ws.pendingApps[i];
+ log("Starting from register widgetset", appId);
+ callback(appId);
+ }
+ ws.pendingApps = null;
}
- widgetsets[widgetset].pendingApps = null;
},
getBrowserDetailsParameters: function(parentElementId) {
// Screen height and width
diff --git a/client/src/com/vaadin/client/ApplicationConfiguration.java b/client/src/com/vaadin/client/ApplicationConfiguration.java
index d483b39a7b..543a48f61b 100644
--- a/client/src/com/vaadin/client/ApplicationConfiguration.java
+++ b/client/src/com/vaadin/client/ApplicationConfiguration.java
@@ -222,6 +222,7 @@ public class ApplicationConfiguration implements EntryPoint {
private boolean browserDetailsSent = false;
private boolean widgetsetVersionSent = false;
+ private static boolean moduleLoaded = false;
static// TODO consider to make this hashmap per application
LinkedList<Command> callbacks = new LinkedList<Command>();
@@ -596,6 +597,13 @@ public class ApplicationConfiguration implements EntryPoint {
@Override
public void onModuleLoad() {
+
+ // Don't run twice if the module has been inherited several times.
+ if (moduleLoaded) {
+ return;
+ }
+ moduleLoaded = true;
+
Profiler.initialize();
Profiler.enter("ApplicationConfiguration.onModuleLoad");