Revert "Use only Gerrit.install as a plugin loaded signal"

This reverts commit 81b58f8a71.

Reason for revert: This seems to be the cause of issue 7415, where some
HTML style plugins would not load. Whereas this change reduces the
number of times that `_pluginsPending` is decremented, following this
change, the value is not decremented enough. Have locally reproduced the
error and found reverting this change fixes style plugin loading.

Change-Id: Iabe99284fbc5f0837aa9c41f20aff8fe8430d735
This commit is contained in:
Wyatt Allen
2017-10-13 18:42:14 +00:00
parent 81b58f8a71
commit 96d037968f
4 changed files with 16 additions and 15 deletions

View File

@@ -93,8 +93,7 @@ limitations under the License.
plugin: { plugin: {
js_resource_paths: [], js_resource_paths: [],
html_resource_paths: [ html_resource_paths: [
new URL('test/plugin.html?' + Math.random(), new URL('test/plugin.html', window.location.href).toString(),
window.location.href).toString(),
], ],
}, },
}; };

View File

@@ -24,8 +24,6 @@ limitations under the License.
<link rel="import" href="gr-endpoint-decorator.html"> <link rel="import" href="gr-endpoint-decorator.html">
<link rel="import" href="../gr-endpoint-param/gr-endpoint-param.html"> <link rel="import" href="../gr-endpoint-param/gr-endpoint-param.html">
<script>void(0);</script>
<test-fixture id="basic"> <test-fixture id="basic">
<template> <template>
<gr-endpoint-decorator name="foo"> <gr-endpoint-decorator name="foo">

View File

@@ -47,10 +47,12 @@
* States that it expects no more than 3 parameters, but that's not true. * States that it expects no more than 3 parameters, but that's not true.
* @todo (beckysiegel) check Polymer annotations and submit change. * @todo (beckysiegel) check Polymer annotations and submit change.
*/ */
_importHtmlPlugins(plugins) { _importHtmlPlugins(plugins) {
for (const url of plugins) { for (const url of plugins) {
this.importHref( this.importHref(
this._urlFor(url), null, Gerrit._pluginInstalled, true); this._urlFor(url), Gerrit._pluginInstalled, Gerrit._pluginInstalled,
true);
} }
}, },

View File

@@ -23,8 +23,6 @@ limitations under the License.
<link rel="import" href="../../../test/common-test-setup.html"/> <link rel="import" href="../../../test/common-test-setup.html"/>
<link rel="import" href="gr-plugin-host.html"> <link rel="import" href="gr-plugin-host.html">
<script>void(0);</script>
<test-fixture id="basic"> <test-fixture id="basic">
<template> <template>
<gr-plugin-host></gr-plugin-host> <gr-plugin-host></gr-plugin-host>
@@ -63,9 +61,9 @@ limitations under the License.
plugin: {html_resource_paths: ['foo/bar', 'baz']}, plugin: {html_resource_paths: ['foo/bar', 'baz']},
}; };
assert.isTrue(element.importHref.calledWith( assert.isTrue(element.importHref.calledWith(
'/foo/bar', null, Gerrit._pluginInstalled, true)); '/foo/bar', Gerrit._pluginInstalled, Gerrit._pluginInstalled, true));
assert.isTrue(element.importHref.calledWith( assert.isTrue(element.importHref.calledWith(
'/baz', null, Gerrit._pluginInstalled, true)); '/baz', Gerrit._pluginInstalled, Gerrit._pluginInstalled, true));
}); });
test('imports relative html plugins from config with a base url', () => { test('imports relative html plugins from config with a base url', () => {
@@ -73,9 +71,11 @@ limitations under the License.
element.config = { element.config = {
plugin: {html_resource_paths: ['foo/bar', 'baz']}}; plugin: {html_resource_paths: ['foo/bar', 'baz']}};
assert.isTrue(element.importHref.calledWith( assert.isTrue(element.importHref.calledWith(
'/the-base/foo/bar', null, Gerrit._pluginInstalled, true)); '/the-base/foo/bar', Gerrit._pluginInstalled, Gerrit._pluginInstalled,
true));
assert.isTrue(element.importHref.calledWith( assert.isTrue(element.importHref.calledWith(
'/the-base/baz', null, Gerrit._pluginInstalled, true)); '/the-base/baz', Gerrit._pluginInstalled, Gerrit._pluginInstalled,
true));
}); });
test('imports absolute html plugins from config', () => { test('imports absolute html plugins from config', () => {
@@ -88,9 +88,11 @@ limitations under the License.
}, },
}; };
assert.isTrue(element.importHref.calledWith( assert.isTrue(element.importHref.calledWith(
'http://example.com/foo/bar', null, Gerrit._pluginInstalled, true)); 'http://example.com/foo/bar', Gerrit._pluginInstalled,
Gerrit._pluginInstalled, true));
assert.isTrue(element.importHref.calledWith( assert.isTrue(element.importHref.calledWith(
'https://example.com/baz', null, Gerrit._pluginInstalled, true)); 'https://example.com/baz', Gerrit._pluginInstalled,
Gerrit._pluginInstalled, true));
}); });
test('adds js plugins from config to the body', () => { test('adds js plugins from config to the body', () => {
@@ -137,9 +139,9 @@ limitations under the License.
}, },
}; };
assert.isTrue(element.importHref.calledWith( assert.isTrue(element.importHref.calledWith(
'/oof', null, Gerrit._pluginInstalled, true)); '/oof', Gerrit._pluginInstalled, Gerrit._pluginInstalled, true));
assert.isTrue(element.importHref.calledWith( assert.isTrue(element.importHref.calledWith(
'/some', null, Gerrit._pluginInstalled, true)); '/some', Gerrit._pluginInstalled, Gerrit._pluginInstalled, true));
}); });
}); });
</script> </script>