Reviewers: knorton,

http://gwt-code-reviews.appspot.com/33840/diff/1003/5
File dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js (right):

http://gwt-code-reviews.appspot.com/33840/diff/1003/5#newcode325
Line 325:
document.getElementsByTagName('head')[0].appendChild(scriptFrame);
D'oh! I just noticed the tabs here. Pretend I've already fixed them (not
worth uploading another patch just for that...).

http://gwt-code-reviews.appspot.com/33840/diff/1003/5#newcode325
Line 325:
document.getElementsByTagName('head')[0].appendChild(scriptFrame);
One other note: I've yet to find a browser that doesn't auto-create a
<head> element, even if it's unspecified in the outer HTML page. I
tested this by nuking Hello.html's <head> tag and refreshing OOPHM in
every browser I have (FF2/3, Safari3, Chrome, IE6/7).



Please review this at http://gwt-code-reviews.appspot.com/33840

Affected files:
   M     dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html
   M     dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js


Index: dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html
===================================================================
--- dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html        
(revision  
5492)
+++ dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html        
(working  
copy)
@@ -4,11 +4,21 @@
  var $doc = $wnd.document;
  var $moduleName, $moduleBase
  ,$stats = $wnd.__gwtStatsEvent ? function(a) {return  
$wnd.__gwtStatsEvent(a);} : null;
+
+// The module to be loaded can be specified either through the url query
+// parameter (as done by the legacy HostedModeTemplate.js), or by  
specifying
+// window.name (as done by IFrameTemplate.js). When the former approach
+// is removed, we can drop the window.location.search part of this logic.
+var moduleFuncName = window.location.search.substring(1);
+if (!moduleFuncName || !$wnd[moduleFuncName]) {
+       moduleFuncName = window.name;
+}
+
+var moduleFunc = $wnd[moduleFuncName];
+var moduleName = moduleFunc ? moduleFunc.moduleName : "unknown";
+
  // Lightweight metrics
  if ($stats) {
-  var moduleFuncName = location.search.substr(1);
-  var moduleFunc = $wnd[moduleFuncName];
-  var moduleName = moduleFunc ? moduleFunc.moduleName : "unknown";
     
$stats({moduleName:moduleName,subSystem:'startup',evtGroup:'moduleStartup',millis:(new
  
Date()).getTime(),type:'moduleEvalStart'});
  }

@@ -241,13 +251,5 @@
    }
  }

-// The module to be loaded can be specified either through the url query
-// parameter (as done by the legacy HostedModeTemplate.js), or by  
specifying
-// window.__gwt_module (as done by IFrameTemplate.js). When the former  
approach
-// is removed, we can drop the 'query' part of this logic.
-query = window.location.search.substring(1);
-if (query && $wnd[query]) setTimeout($wnd[query].onScriptLoad, 1);
-
-var module  = window.__gwt_module;
-if (module && $wnd[module]) setTimeout($wnd[module].onScriptLoad, 1);
+setTimeout($wnd[moduleFuncName].onScriptLoad, 1);
  --></script></body></html>
Index: dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js
===================================================================
--- dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js   (revision  
5492)
+++ dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js   (working copy)
@@ -322,14 +322,14 @@
          scriptFrame.id = '__MODULE_NAME__';
          scriptFrame.style.cssText = 'position:absolute; width:0; height:0;  
border:none';
          scriptFrame.tabIndex = -1;
-        document.body.appendChild(scriptFrame);
+                               
document.getElementsByTagName('head')[0].appendChild(scriptFrame);

          // Expose the module function via an expando on the iframe's  
window.
          // (this is needed for the compiled script to call back into
          //  onScriptLoad()).
          var win = scriptFrame.contentWindow;
          if (isHostedMode()) {
-          win.__gwt_module = '__MODULE_FUNC__';
+          win.name = '__MODULE_FUNC__';
          }

          // Inject the fetched script into the script frame.



--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to