Reviewers: jgw, knorton,

Description:
This patch fixes the issue Kelly found where the iframe used to display
an OOPHM troubleshooting page might not be ready to redirect to the URL.
  The fix is to simply specify the URL when the iframe is created, as the
"javascript:''" hack is not needed here.

Also add support for gwt.codesvr in addition to gwt.hosted as the query
parameter (what is generated in the URL will be updated in MS2).

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

Affected files:
   dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html
   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  
5977)
+++ dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html        
(working  
copy)
@@ -1,5 +1,6 @@
  <html>
  <head><script>
+// TODO(jat): wrap these to reduce namespace issues
  var $wnd = parent;
  var $doc = $wnd.document;
  var $moduleName, $moduleBase
@@ -35,12 +36,11 @@

  function loadIframe(url) {
    var iframe = $doc.createElement('iframe');
-  iframe.src = "javascript:''";
+  iframe.src = url;
    iframe.style.width = "100%";
    iframe.style.height = "100%";
    iframe.style.borderWidth = "0px";
    $doc.body.insertBefore(iframe, $doc.body.firstChild);
-  iframe.contentWindow.location.replace(url);
  }

  if ($legacyHosted) {
@@ -273,13 +273,22 @@
      document.write('</object>');
    }

-  var idx = query.indexOf("gwt.hosted=");
+  // look for the old query parameter if we don't find the new one
+  var idx = query.indexOf("gwt.codesvr=");
    if (idx >= 0) {
+    idx += 12;  // "gwt.codesvr=".length() == 12
+  } else {
+    idx = query.indexOf("gwt.hosted=");
+    if (idx >= 0) {
+      idx += 11;  // "gwt.hosted=".length() == 11
+    }
+  }
+  if (idx >= 0) {
      var amp = query.indexOf("&", idx);
      if (amp >= 0) {
-      $hosted = query.substring(idx + 11, amp);
+      $hosted = query.substring(idx, amp);
      } else {
-      $hosted = query.substring(idx + 11);
+      $hosted = query.substring(idx);
      }

      // According to RFC 3986, some of this component's characters  
(e.g., ':')
Index: dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js
===================================================================
--- dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js   (revision  
5977)
+++ dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js   (working copy)
@@ -68,7 +68,8 @@
      var result = false;
      try {
        var query = $wnd.location.search;
-      return (query.indexOf('gwt.hosted=') != -1
+      return (query.indexOf('gwt.codesvr=') != -1
+          || query.indexOf('gwt.hosted=') != -1
            || ($wnd.external && $wnd.external.gwtOnLoad)) &&
            (query.indexOf('gwt.hybrid') == -1);
      } catch (e) {



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

Reply via email to