diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt index 6c6489e23f..da8611dd1f 100644 --- a/Documentation/config-gerrit.txt +++ b/Documentation/config-gerrit.txt @@ -2600,14 +2600,6 @@ By default, unset, so no Expiry-Date header is generated. [[site]] === Section site -[[site.checkUserAgent]]site.checkUserAgent:: -+ -If true the server checks the User-Agent HTTP header and sends the -correct JavaScript to the client as part of the initial page load. -This usually reduces a round-trip for the client, allowing the UI to -start more quickly. If false, a tiny JavaScript loader is sent to the -client instead to determine the correct code to use. Default is true. - [[site.refreshHeaderFooter]]site.refreshHeaderFooter:: + If true the server checks the site header, footer and CSS files for diff --git a/gerrit-gwtexpui/BUCK b/gerrit-gwtexpui/BUCK index b2a9ca6cf9..76d07415da 100644 --- a/gerrit-gwtexpui/BUCK +++ b/gerrit-gwtexpui/BUCK @@ -43,14 +43,6 @@ gwt_module( visibility = ['PUBLIC'], ) -java_library( - name = 'Linker', - srcs = glob([SRC + 'linker/rebind/*.java']), - resources = [SRC + 'linker/ServerPlannedIFrameLinker.gwt.xml'], - deps = ['//lib/gwt:dev'], - visibility = ['PUBLIC'], -) - java_library2( name = 'linker_server', srcs = glob([SRC + 'linker/server/*.java']), diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/linker/ServerPlannedIFrameLinker.gwt.xml b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/linker/ServerPlannedIFrameLinker.gwt.xml deleted file mode 100644 index a6978ab1da..0000000000 --- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/linker/ServerPlannedIFrameLinker.gwt.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/linker/rebind/ServerPlannedIFrameLinker.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/linker/rebind/ServerPlannedIFrameLinker.java deleted file mode 100644 index 371b644972..0000000000 --- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/linker/rebind/ServerPlannedIFrameLinker.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (C) 2009 The Android Open Source Project -// -// 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.gwtexpui.linker.rebind; - -import com.google.gwt.core.ext.LinkerContext; -import com.google.gwt.core.ext.TreeLogger; -import com.google.gwt.core.ext.UnableToCompleteException; -import com.google.gwt.core.ext.linker.AbstractLinker; -import com.google.gwt.core.ext.linker.ArtifactSet; -import com.google.gwt.core.ext.linker.CompilationResult; -import com.google.gwt.core.ext.linker.LinkerOrder; -import com.google.gwt.core.ext.linker.SelectionProperty; -import com.google.gwt.core.ext.linker.StylesheetReference; - -import java.util.Map; -import java.util.SortedMap; - -/** Saves data normally used by the {@code nocache.js} file. */ -@LinkerOrder(LinkerOrder.Order.POST) -public class ServerPlannedIFrameLinker extends AbstractLinker { - @Override - public String getDescription() { - return "ServerPlannedIFrameLinker"; - } - - @Override - public ArtifactSet link(final TreeLogger logger, final LinkerContext context, - final ArtifactSet artifacts) throws UnableToCompleteException { - ArtifactSet toReturn = new ArtifactSet(artifacts); - - StringBuilder table = new StringBuilder(); - for (StylesheetReference r : artifacts.find(StylesheetReference.class)) { - table.append("css "); - table.append(r.getSrc()); - table.append("\n"); - } - - for (CompilationResult r : artifacts.find(CompilationResult.class)) { - table.append(r.getStrongName()); - table.append("\n"); - for (SortedMap p : r.getPropertyMap()) { - for (Map.Entry e : p.entrySet()) { - table.append(" "); - table.append(e.getKey().getName()); - table.append("="); - table.append(e.getValue()); - table.append('\n'); - } - } - table.append("\n"); - } - - toReturn.add(emitString(logger, table.toString(), "permutations")); - return toReturn; - } -} diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/linker/server/ClientSideRule.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/linker/server/ClientSideRule.java deleted file mode 100644 index 89da5292bf..0000000000 --- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/linker/server/ClientSideRule.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2009 The Android Open Source Project -// -// 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.gwtexpui.linker.server; - -import javax.servlet.http.HttpServletRequest; - -/** A rule that must execute on the client, as we don't know how to compute it. */ -final class ClientSideRule implements Rule { - private final String name; - - ClientSideRule(String name) { - this.name = name; - } - - @Override - public String getName() { - return name; - } - - @Override - public String select(HttpServletRequest req) { - return null; - } -} diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/linker/server/Permutation.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/linker/server/Permutation.java deleted file mode 100644 index 5b0ef4995a..0000000000 --- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/linker/server/Permutation.java +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (C) 2009 The Android Open Source Project -// -// 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.gwtexpui.linker.server; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Arrays; - -/** A single permutation of the compiled GWT application. */ -public class Permutation { - private final PermutationSelector selector; - private final String cacheHTML; - private final String[] values; - - Permutation(PermutationSelector sel, String cacheHTML, String[] values) { - this.selector = sel; - this.cacheHTML = cacheHTML; - this.values = values; - } - - boolean matches(String[] r) { - return Arrays.equals(values, r); - } - - /** - * Append GWT bootstrap for this permutation onto the end of the body. - *

- * The GWT bootstrap for this particular permutation is appended onto the end - * of the {@code body} element of the passed host page. - *

- * To keep the bootstrap code small and simple, not all GWT features are - * actually supported. The {@code gwt:property}, {@code gwt:onPropertyErrorFn} - * and {@code gwt:onLoadErrorFn} meta tags are ignored and not handled. - *

- * Load order may differ from the standard GWT {@code nocache.js}. The browser - * is asked to load the iframe immediately, rather than after the body has - * finished loading. - * - * @param dom host page HTML document. - */ - public void inject(Document dom) { - String moduleName = selector.getModuleName(); - - StringBuilder s = new StringBuilder(); - s.append("\n"); - s.append("function ").append(moduleName).append("(){"); - s.append("var s,l,t"); - s.append(",w=window"); - s.append(",d=document"); - s.append(",n='").append(moduleName).append("'"); - s.append(",f=d.createElement('iframe')"); - s.append(";"); - - // Callback to execute the module once both s and l are true. - // - s.append("function m(){"); - s.append("if(s&&l){"); - // Base path needs to be absolute. There isn't an easy way to do this - // other than forcing an image to load and then pulling the URL back. - // - s.append("var b,i=d.createElement('img');"); - s.append("i.src=n+'/clear.cache.gif';"); - s.append("b=i.src;"); - s.append("b=b.substring(0,b.lastIndexOf('/')+1);"); - s.append(moduleName).append("=null;"); // allow us to GC - s.append("f.contentWindow.gwtOnLoad(undefined,n,b);"); - s.append("}"); - s.append("}"); - - // Set s true when the module script has finished loading. The - // exact name here is known to the IFrameLinker and is called by - // the code in the iframe. - // - s.append(moduleName).append(".onScriptLoad=function(){"); - s.append("s=1;m();"); - s.append("};"); - - // Set l true when the browser has finished processing the iframe - // tag, and everything else on the page. - // - s.append(moduleName).append(".r=function(){"); - s.append("l=1;m();"); - s.append("};"); - - // Prevents mixed mode security in IE6/7. - s.append("f.src=\"javascript:''\";"); - s.append("f.id=n;"); - s.append("f.style.cssText"); - s.append("='position:absolute;width:0;height:0;border:none';"); - s.append("f.tabIndex=-1;"); - s.append("d.body.appendChild(f);"); - - // The src has to be set after the iframe is attached to the DOM to avoid - // refresh quirks in Safari. We have to use the location.replace trick to - // avoid FF2 refresh quirks. - // - s.append("f.contentWindow.location.replace(n+'/").append(cacheHTML).append("');"); - - // defer attribute here is to workaround IE running immediately. - // - s.append("d.write('