Merge "Clean up Polymer1 and Polymer2 separation" into stable-3.1

This commit is contained in:
David Pursehouse
2019-10-18 07:08:12 +00:00
committed by Gerrit Code Review
8 changed files with 12 additions and 133 deletions

View File

@@ -112,9 +112,6 @@ public class IndexHtmlUtil {
SanitizedContent sanitizedStaticPath = urlInScriptTagOrdainer.apply(staticPath);
ImmutableMap.Builder<String, Object> data = ImmutableMap.builder();
// TODO(taoalpha): Remove once p2 fully rolled out
data.put("polymer2", "true");
if (canonicalPath != null) {
data.put("canonicalPath", canonicalPath);
}

View File

@@ -29,7 +29,7 @@ public class IndexHtmlUtilTest {
assertThat(
staticTemplateData(
"http://example.com/", null, null, new HashMap<>(), IndexHtmlUtilTest::ordain))
.containsExactly("canonicalPath", "", "polymer2", "true", "staticResourcePath", ordain(""));
.containsExactly("canonicalPath", "", "staticResourcePath", ordain(""));
}
@Test
@@ -41,13 +41,7 @@ public class IndexHtmlUtilTest {
null,
new HashMap<>(),
IndexHtmlUtilTest::ordain))
.containsExactly(
"canonicalPath",
"/gerrit",
"polymer2",
"true",
"staticResourcePath",
ordain("/gerrit"));
.containsExactly("canonicalPath", "/gerrit", "staticResourcePath", ordain("/gerrit"));
}
@Test
@@ -60,12 +54,7 @@ public class IndexHtmlUtilTest {
new HashMap<>(),
IndexHtmlUtilTest::ordain))
.containsExactly(
"canonicalPath",
"",
"polymer2",
"true",
"staticResourcePath",
ordain("http://my-cdn.com/foo/bar/"));
"canonicalPath", "", "staticResourcePath", ordain("http://my-cdn.com/foo/bar/"));
}
@Test
@@ -78,12 +67,7 @@ public class IndexHtmlUtilTest {
new HashMap<>(),
IndexHtmlUtilTest::ordain))
.containsExactly(
"canonicalPath",
"/gerrit",
"polymer2",
"true",
"staticResourcePath",
ordain("http://my-cdn.com/foo/bar/"));
"canonicalPath", "/gerrit", "staticResourcePath", ordain("http://my-cdn.com/foo/bar/"));
}
private static SanitizedContent ordain(String s) {

View File

@@ -18,8 +18,7 @@ polygerrit_bundle(
],
),
outs = ["polygerrit_ui.zip"],
# TODO(taoalpha): replace with gr-app.html once p2 fully rolled out
app = "elements/gr-app-p2.html",
app = "elements/gr-app.html",
)
bower_component_bundle(

View File

@@ -1,44 +0,0 @@
<!--
@license
Copyright (C) 2019 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.
-->
<!--
TODO(taoalpha): This file only used by google,
remove once polymer 2 fully rolled out.
-->
<script>
window.Gerrit = window.Gerrit || {};
</script>
<link rel="import" href="/bower_components/polymer/polymer.html">
<link rel="import" href="/bower_components/polymer-resin/standalone/polymer-resin.html">
<link rel="import" href="/bower_components/polymer/lib/legacy/legacy-data-mixin.html">
<link rel="import" href="../behaviors/safe-types-behavior/safe-types-behavior.html">
<script>
security.polymer_resin.install({
allowedIdentifierPrefixes: [''],
reportHandler: security.polymer_resin.CONSOLE_LOGGING_REPORT_HANDLER,
safeTypesBridge: Gerrit.SafeTypes.safeTypesBridge,
});
</script>
<link rel="import" href="./gr-app-element.html">
<dom-module id="gr-app-p2">
<template>
<gr-app-element id="app-element"></gr-app-element>
</template>
<script src="gr-app-p2.js" crossorigin="anonymous"></script>
</dom-module>

View File

@@ -1,26 +0,0 @@
/**
* @license
* Copyright (C) 2019 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.
*/
// TODO(taoalpha): This file is only used by google,
// remove once polymer fully rolled out.
(function() {
'use strict';
Polymer({
is: 'gr-app-p2',
});
})();

View File

@@ -15,21 +15,11 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<script>
// TODO(taoalpha): clean up after p2 fully rolled out
if (!window.POLYMER2) {
// This must be set prior to loading Polymer for the first time.
if (localStorage.getItem('USE_SHADOW_DOM') === 'true') {
window.Polymer = {
dom: 'shadow',
passiveTouchGestures: true,
lazyRegister: true,
};
} else if (!window.Polymer) {
window.Polymer = {
passiveTouchGestures: true,
lazyRegister: true,
};
}
if (!window.Polymer) {
window.Polymer = {
passiveTouchGestures: true,
lazyRegister: true,
};
}
window.Gerrit = window.Gerrit || {};
</script>

View File

@@ -17,15 +17,6 @@
(function() {
'use strict';
// Eagerly render Polymer components when backgrounded. (Skips
// requestAnimationFrame.)
// @see https://github.com/Polymer/polymer/issues/3851
// @see Issue 4699
// TODO(taoalpha): Remove once p2 fully rolled out
if (!window.POLYMER2) {
Polymer.RenderStatus._makeReady();
}
Polymer({
is: 'gr-app',
});

View File

@@ -24,7 +24,6 @@
{@param? assetsBundle: ?} /** {string} Assets bundle .html file, served from $assetsPath. */
{@param? faviconPath: ?}
{@param? versionInfo: ?}
{@param? polymer2: ?}
{@param? polyfillCE: ?}
{@param? polyfillSD: ?}
{@param? polyfillSC: ?}
@@ -43,8 +42,6 @@
// Disable extra font load from paper-styles
window.polymerSkipLoadingFontRoboto = true;
window.CLOSURE_NO_DEPS = true;
// TODO(taoalpha): clean up once p2 fully rolled out
{if $polymer2}window.POLYMER2 = true;{/if}
{if $canonicalPath != ''}window.CANONICAL_PATH = '{$canonicalPath}';{/if}
{if $versionInfo}window.VERSION_INFO = '{$versionInfo}';{/if}
{if $staticResourcePath != ''}window.STATIC_RESOURCE_PATH = '{$staticResourcePath}';{/if}
@@ -94,17 +91,8 @@
<link rel="import" href="{$assetsPath}/{$assetsBundle}">{\n}
{/if}
// TODO(taoalpha): only used by Google, remove once polymer 2 fully rolled out
{if $polymer2}
<link rel="import" href="{$staticResourcePath}/elements/gr-app-p2.html">{\n}
{else}
<link rel="import" href="{$staticResourcePath}/elements/gr-app.html">{\n}
{/if}
<link rel="import" href="{$staticResourcePath}/elements/gr-app.html">{\n}
<body unresolved>{\n}
{if $polymer2}
<gr-app-p2 id="app"></gr-app-p2>{\n}
{else}
<gr-app id="app"></gr-app>{\n}
{/if}
<gr-app id="app"></gr-app>{\n}
{/template}