diff --git a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.js b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.js index b75ae44bf1..7476637016 100644 --- a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.js +++ b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.js @@ -40,7 +40,7 @@ this._handleMigrations(plugins.js_resource_paths || [], htmlPlugins) .map(p => this._urlFor(p)) .filter(p => !Gerrit._isPluginPreloaded(p)); - const defaultTheme = config.default_theme; + const defaultTheme = this._urlFor(config.default_theme); const pluginsPending = [].concat(jsPlugins, htmlPlugins, defaultTheme || []); Gerrit._setPluginsPending(pluginsPending); @@ -98,6 +98,9 @@ }, _urlFor(pathOrUrl) { + if (!pathOrUrl) { + return pathOrUrl; + } if (pathOrUrl.startsWith('preloaded:') || pathOrUrl.startsWith('http')) { // Plugins are loaded from another domain or preloaded. diff --git a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host_test.html b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host_test.html index 641a800166..26958eeea7 100644 --- a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host_test.html +++ b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host_test.html @@ -188,6 +188,15 @@ limitations under the License. assert.equal(Gerrit._pluginInstallError.callCount, 2); }); + test('default theme is loaded with html plugins', () => { + sandbox.stub(Gerrit, '_setPluginsPending'); + element.config = { + default_theme: '/oof', + plugin: {}, + }; + assert.isTrue(Gerrit._setPluginsPending.calledWith([url + '/oof'])); + }); + test('skips preloaded plugins', () => { sandbox.stub(Gerrit, '_isPluginPreloaded') .withArgs(url + '/plugins/foo/bar').returns(true)