Fixes a crazy IE7 bookmark bug. When a user bookmarks a page with a history
token, loading that page from the bookmarks results in a JavaScript error.
It turns out that a phanton version of our compiled iframe (presumably a
cached version) is calling into the startup sequence before we even inject
the proper compiled code iframe. We fix this by simply disallowing calls to
onScriptLoad if the iframe has yet to be injected.
Review by: scottb (desk)
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@2923 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/core/ext/linker/impl/HostedModeTemplate.js b/dev/core/src/com/google/gwt/core/ext/linker/impl/HostedModeTemplate.js
index eefedd3..a0d8600 100644
--- a/dev/core/src/com/google/gwt/core/ext/linker/impl/HostedModeTemplate.js
+++ b/dev/core/src/com/google/gwt/core/ext/linker/impl/HostedModeTemplate.js
@@ -274,10 +274,15 @@
// Called when the compiled script identified by moduleName is done loading.
//
__MODULE_FUNC__.onScriptLoad = function() {
- // Mark this module's script as done loading and (possibly) start the module.
- $stats && $stats('__MODULE_NAME__', 'startup', 'module', {evalEnd:(new Date()).getTime()});
- loadDone = true;
- maybeStartModule();
+ // IE7 bookmark bug. A phantom (presumably cached) version of our compiled iframe
+ // can call onScriptLoad before we even properly inject the iframe. So if this is
+ // called before the frame was injected ... it is completely bogus.
+ if (frameInjected) {
+ // Mark this module's script as done loading and (possibly) start the module.
+ $stats && $stats('__MODULE_NAME__', 'startup', 'module', {evalEnd:(new Date()).getTime()});
+ loadDone = true;
+ maybeStartModule();
+ }
}
// --------------- STRAIGHT-LINE CODE ---------------
diff --git a/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js b/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js
index 415e221..3e99a45 100644
--- a/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js
+++ b/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js
@@ -274,9 +274,14 @@
// Called when the compiled script identified by moduleName is done loading.
//
__MODULE_FUNC__.onScriptLoad = function() {
- // Mark this module's script as done loading and (possibly) start the module.
- loadDone = true;
- maybeStartModule();
+ // IE7 bookmark bug. A phantom (presumably cached) version of our compiled iframe
+ // can call onScriptLoad before we even properly inject the iframe. So if this is
+ // called before the frame was injected ... it is completely bogus.
+ if (frameInjected) {
+ // Mark this module's script as done loading and (possibly) start the module.
+ loadDone = true;
+ maybeStartModule();
+ }
}
// --------------- STRAIGHT-LINE CODE ---------------