Reviewers: unnurg,

Message:
This is a small change to the xsiframe linker. These hoops are a legacy
from the xs linker that is no longer needed. Since xsiframe has an
iframe, the code can be directly installed instead of being passed
around in a string.

Description:
The cross-site iframe linker now loads deferred JS code via script tags
holding
the code directly. It no longer has the code in a string literal that
gets passed
around through several layers of code before being evaluated.

Review by: unn...@google.com

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

Affected files:
  M dev/core/src/com/google/gwt/core/linker/CrossSiteIframeLinker.java
  M dev/core/src/com/google/gwt/core/linker/CrossSiteIframeTemplate.js
M user/src/com/google/gwt/core/client/impl/CrossSiteIframeLoadingStrategy.java


Index: dev/core/src/com/google/gwt/core/linker/CrossSiteIframeLinker.java
===================================================================
--- dev/core/src/com/google/gwt/core/linker/CrossSiteIframeLinker.java (revision 8762) +++ dev/core/src/com/google/gwt/core/linker/CrossSiteIframeLinker.java (working copy)
@@ -41,20 +41,6 @@
   @Override
   public String getDescription() {
     return "Cross-Site-Iframe";
-  }
-
-  @Override
-  protected String generateDeferredFragment(TreeLogger logger,
-      LinkerContext context, int fragment, String js) {
-    StringBuilder sb = new StringBuilder();
-    sb.append("$wnd.");
-    sb.append(context.getModuleFunctionName());
-    sb.append(".runAsyncCallback");
-    sb.append(fragment);
-    sb.append("(");
-    sb.append(JsToStringGenerationVisitor.javaScriptString(js));
-    sb.append(");\n");
-    return sb.toString();
   }

   @Override
Index: dev/core/src/com/google/gwt/core/linker/CrossSiteIframeTemplate.js
===================================================================
--- dev/core/src/com/google/gwt/core/linker/CrossSiteIframeTemplate.js (revision 8762) +++ dev/core/src/com/google/gwt/core/linker/CrossSiteIframeTemplate.js (working copy)
@@ -236,10 +236,6 @@
       type: 'end',
     });
   }
-
-  // Install code pulled in via runAsync
-  //
-  __MODULE_FUNC__.installCode = installCode;

   // --------------- STRAIGHT-LINE CODE ---------------

Index: user/src/com/google/gwt/core/client/impl/CrossSiteIframeLoadingStrategy.java
===================================================================
--- user/src/com/google/gwt/core/client/impl/CrossSiteIframeLoadingStrategy.java (revision 8762) +++ user/src/com/google/gwt/core/client/impl/CrossSiteIframeLoadingStrategy.java (working copy)
@@ -113,18 +113,7 @@
      }
    }-*/;

-  private static native JavaScriptObject removeTagAndEvalCode(int fragment,
-      JavaScriptObject tag) /*-{
-     return function(code) {
-       var head = document.getElementsByTagName('head').item(0);
- @com.google.gwt.core.client.impl.CrossSiteIframeLoadingStrategy::clearOnSuccess(*)(fragment); - @com.google.gwt.core.client.impl.CrossSiteIframeLoadingStrategy::clearCallbacks(*)(tag);
-       head.removeChild(tag);
-       __gwtModuleFunction.installCode(code, false);
-     }
-   }-*/;
-
-  private static native void setOnFailure(JavaScriptObject script,
+  private static native void setOnTerminated(JavaScriptObject script,
       JavaScriptObject callback) /*-{
var exception = @com.google.gwt.core.client.impl.CrossSiteIframeLoadingStrategy::LoadTerminated;
     script.onerror = function() {
@@ -141,21 +130,12 @@
     }
   }-*/;

-  /**
-   * Set the success callback for fragment <code>fragment</code>
-   * to the supplied JavaScript function.
-   */
- private static native void setOnSuccess(int fragment, JavaScriptObject callback) /*-{
-    __gwtModuleFunction['runAsyncCallback'+fragment] = callback;
-  }-*/;
-
   private final IntToIntMap serialNumbers = IntToIntMap.create();

   public void startLoadingFragment(int fragment,
       LoadTerminatedHandler loadFinishedHandler) {
     JavaScriptObject tag = createScriptTag(getUrl(fragment));
-    setOnSuccess(fragment, removeTagAndEvalCode(fragment, tag));
-    setOnFailure(tag, removeTagAndCallErrorHandler(fragment, tag,
+    setOnTerminated(tag, removeTagAndCallErrorHandler(fragment, tag,
         loadFinishedHandler));
     installScriptTag(tag);
   }


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

Reply via email to