Revision: 10160
Author: [email protected]
Date: Fri May 6 12:04:58 2011
Log: Make debugging the new linker bootstrap a little easier
Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=10160
Added:
/trunk/dev/core/src/com/google/gwt/core/linker/DirectInstallLinker.java
Modified:
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/SelectionScriptLinker.java
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/installScriptDirect.js
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/installScriptEarlyDownload.js
/trunk/dev/core/src/com/google/gwt/core/linker/CrossSiteIframeLinker.java
/trunk/user/src/com/google/gwt/core/CrossSiteIframeLinker.gwt.xml
=======================================
--- /dev/null
+++ /trunk/dev/core/src/com/google/gwt/core/linker/DirectInstallLinker.java
Fri May 6 12:04:58 2011
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
not
+ * use this file except in compliance with the License. You may obtain a
copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
under
+ * the License.
+ */
+
+package com.google.gwt.core.linker;
+
+import com.google.gwt.core.ext.LinkerContext;
+
+/**
+ * A linker that adds a script tag to the iframe rather than downloading
the
+ * code as a string and then installing it into the iframe.
+ */
+public class DirectInstallLinker extends CrossSiteIframeLinker {
+ @Override
+ protected String getJsInstallScript(LinkerContext context) {
+ return "com/google/gwt/core/ext/linker/impl/installScriptDirect.js";
+ }
+
+ @Override
+ protected boolean shouldInstallCode(LinkerContext context) {
+ return false;
+ }
+}
=======================================
---
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/SelectionScriptLinker.java
Wed Apr 20 11:42:37 2011
+++
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/SelectionScriptLinker.java
Fri May 6 12:04:58 2011
@@ -362,7 +362,7 @@
protected String wrapPrimaryFragment(TreeLogger logger,
LinkerContext context, String script, ArtifactSet artifacts,
- CompilationResult result) {
+ CompilationResult result) throws UnableToCompleteException {
return script;
}
=======================================
---
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/installScriptDirect.js
Wed Oct 27 13:37:45 2010
+++
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/installScriptDirect.js
Fri May 6 12:04:58 2011
@@ -15,9 +15,11 @@
sendStats('moduleStartup', 'moduleRequested');
docbody.appendChild(script);
- // Remove the tags to shrink the DOM a little.
+ // Unless we're in pretty mode, remove the tags to shrink the DOM a
little.
// It should have installed its code immediately after being added.
+ __START_OBFUSCATED_ONLY__
docbody.removeChild(script);
+ __END_OBFUSCATED_ONLY__
}
// Just pass along the filename so that a script tag can be installed in
the
=======================================
---
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/installScriptEarlyDownload.js
Tue Feb 8 09:31:49 2011
+++
/trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/installScriptEarlyDownload.js
Fri May 6 12:04:58 2011
@@ -16,9 +16,11 @@
script.text = code;
docbody.appendChild(script);
- // Remove the tags to shrink the DOM a little.
+ // Unless we're in pretty mode, remove the tags to shrink the DOM a
little.
// It should have installed its code immediately after being added.
+ __START_OBFUSCATED_ONLY__
docbody.removeChild(script);
+ __END_OBFUSCATED_ONLY__
}
// Set up a script tag to start downloading immediately, as well as a
=======================================
---
/trunk/dev/core/src/com/google/gwt/core/linker/CrossSiteIframeLinker.java
Fri May 6 08:06:47 2011
+++
/trunk/dev/core/src/com/google/gwt/core/linker/CrossSiteIframeLinker.java
Fri May 6 12:04:58 2011
@@ -130,6 +130,14 @@
replaceAll(ss, "__MODULE_NAME__", context.getModuleName());
replaceAll(ss, "__HOSTED_FILENAME__", getHostedFilenameFull(context));
+ if (context.isOutputCompact()) {
+ replaceAll(ss, "__START_OBFUSCATED_ONLY__", "");
+ replaceAll(ss, "__END_OBFUSCATED_ONLY__", "");
+ } else {
+ replaceAll(ss, "__START_OBFUSCATED_ONLY__", "/*");
+ replaceAll(ss, "__END_OBFUSCATED_ONLY__", "*/");
+ }
+
return ss.toString();
}
@@ -408,26 +416,20 @@
@Override
protected String wrapPrimaryFragment(TreeLogger logger, LinkerContext
context, String script,
- ArtifactSet artifacts, CompilationResult result) {
+ ArtifactSet artifacts, CompilationResult result) throws
UnableToCompleteException {
StringBuffer out = new StringBuffer();
if (shouldIncludeBootstrapInPrimaryFragment(context)) {
- try {
- out.append(generateSelectionScript(logger, context, artifacts,
result));
- } catch (UnableToCompleteException e) {
- logger.log(TreeLogger.ERROR, "Problem setting up selection
script", e);
- e.printStackTrace();
- }
- }
-
+ out.append(generateSelectionScript(logger, context, artifacts,
result));
+ }
if (shouldInstallCode(context)) {
// Rewrite the code so it can be installed with
// __MODULE_FUNC__.onScriptDownloaded
out.append(context.getModuleFunctionName());
out.append(".onScriptDownloaded(");
-
out.append(JsToStringGenerationVisitor.javaScriptString(script.toString()));
+ out.append(JsToStringGenerationVisitor.javaScriptString(script));
out.append(")");
} else {
- out.append(script.toString());
+ out.append(script);
}
return out.toString();
}
=======================================
--- /trunk/user/src/com/google/gwt/core/CrossSiteIframeLinker.gwt.xml Tue
Jan 11 12:11:58 2011
+++ /trunk/user/src/com/google/gwt/core/CrossSiteIframeLinker.gwt.xml Fri
May 6 12:04:58 2011
@@ -12,9 +12,10 @@
<!-- implied. License for the specific language governing permissions
and -->
<!-- limitations under the
License. -->
-<!-- Defines the cross-site iframe linker -->
+<!-- Defines the cross-site iframe linker and it's subclasses -->
<module>
<define-linker name="xsiframe"
class="com.google.gwt.core.linker.CrossSiteIframeLinker" />
+ <define-linker name="direct_install"
class="com.google.gwt.core.linker.DirectInstallLinker" />
<define-configuration-property name="xsiframe.failIfScriptTag"
is_multi_valued="FALSE"/>
<set-configuration-property name="xsiframe.failIfScriptTag"
value="TRUE"/>
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors