Browse Source

Avoid errors if window.vaadin does not exist

Change-Id: I5d57ca13030c75831a47bc6f6e1a73b845f7ea73
tags/7.4.0.beta1
Manolo Carrasco 9 years ago
parent
commit
8ac2039ac9
1 changed files with 13 additions and 2 deletions
  1. 13
    2
      client/src/com/vaadin/client/ApplicationConfiguration.java

+ 13
- 2
client/src/com/vaadin/client/ApplicationConfiguration.java View File

@@ -32,6 +32,8 @@ import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.core.client.ScriptInjector;
import com.google.gwt.dom.client.Element;
import com.google.gwt.logging.client.LogConfiguration;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;
@@ -598,11 +600,20 @@ public class ApplicationConfiguration implements EntryPoint {
}
}

private boolean vaadinBootstrapLoaded() {
Element window = ScriptInjector.TOP_WINDOW.cast();
return window.getPropertyJSO("vaadin") != null;
}

@Override
public void onModuleLoad() {

// Don't run twice if the module has been inherited several times.
if (moduleLoaded) {
// Don't run twice if the module has been inherited several times,
// and don't continue if vaadinBootstrap was not executed.
if (moduleLoaded || !vaadinBootstrapLoaded()) {
getLogger()
.log(Level.WARNING,
"vaadinBootstrap.js was not loaded, skipping vaadin application configuration.");
return;
}
moduleLoaded = true;

Loading…
Cancel
Save