Revision: 5981
Author: [email protected]
Date: Thu Aug 20 10:42:37 2009
Log: Correct a problem with showing the troubleshooting iframe, add support  
for
renamed query parameter (while retaining backwards compatibility for now).

Patch by: jat
Review by: knorton

http://code.google.com/p/google-web-toolkit/source/detail?r=5981

Modified:
  /trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html
  /trunk/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js

=======================================
--- /trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html Mon  
Aug 10 16:15:14 2009
+++ /trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html Thu  
Aug 20 10:42:37 2009
@@ -1,5 +1,7 @@
  <html>
  <head><script>
+// TODO(jat): wrap these to reduce namespace issues, and refactor code into
+//    separate functions.
  var $wnd = parent;
  var $doc = $wnd.document;
  var $moduleName, $moduleBase
@@ -35,12 +37,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 +274,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., ':')
=======================================
--- /trunk/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js    Wed  
Jul  8 14:29:31 2009
+++ /trunk/dev/core/src/com/google/gwt/core/linker/IFrameTemplate.js    Thu  
Aug 20 10:42:37 2009
@@ -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