From c594086fd392407be047f749d68bea179826ab4d Mon Sep 17 00:00:00 2001 From: Mike de Boer Date: Thu, 2 Mar 2017 14:22:14 +0100 Subject: [PATCH] Bug 1330349 - Part 1 - move the new theme WebExtension API to the toolkit collection of APIs. r=aswan MozReview-Commit-ID: LERYdJHNvxW --HG-- rename : browser/components/extensions/ext-theme.js => toolkit/components/extensions/ext-theme.js rename : browser/components/extensions/schemas/theme.json => toolkit/components/extensions/schemas/theme.json rename : browser/components/extensions/test/browser/browser_ext_themes_chromeparity.js => toolkit/components/extensions/test/browser/browser_ext_themes_chromeparity.js rename : browser/components/extensions/test/browser/browser_ext_themes_dynamic_updates.js => toolkit/components/extensions/test/browser/browser_ext_themes_dynamic_updates.js rename : browser/components/extensions/test/browser/browser_ext_themes_lwtsupport.js => toolkit/components/extensions/test/browser/browser_ext_themes_lwtsupport.js extra : rebase_source : 17af3a7d6e72b33853534187f1b68c6340cc2895 --- browser/app/profile/firefox.js | 3 --- .../extensions/extensions-browser.manifest | 2 -- browser/components/extensions/jar.mn | 1 - browser/components/extensions/schemas/jar.mn | 1 - .../test/browser/browser-common.ini | 5 +--- modules/libpref/init/all.js | 2 ++ .../components/extensions/ext-theme.js | 0 .../extensions/extensions-toolkit.manifest | 26 ++++++++++--------- toolkit/components/extensions/jar.mn | 15 ++++++----- toolkit/components/extensions/moz.build | 4 +++ toolkit/components/extensions/schemas/jar.mn | 1 + .../components/extensions/schemas/theme.json | 0 .../extensions/test/browser/.eslintrc.js | 18 +++++++++++++ .../extensions/test/browser/browser.ini | 3 +++ .../browser_ext_themes_chromeparity.js | 0 .../browser_ext_themes_dynamic_updates.js | 0 .../browser/browser_ext_themes_lwtsupport.js | 0 17 files changed, 52 insertions(+), 29 deletions(-) rename {browser => toolkit}/components/extensions/ext-theme.js (100%) rename {browser => toolkit}/components/extensions/schemas/theme.json (100%) create mode 100644 toolkit/components/extensions/test/browser/.eslintrc.js create mode 100644 toolkit/components/extensions/test/browser/browser.ini rename {browser => toolkit}/components/extensions/test/browser/browser_ext_themes_chromeparity.js (100%) rename {browser => toolkit}/components/extensions/test/browser/browser_ext_themes_dynamic_updates.js (100%) rename {browser => toolkit}/components/extensions/test/browser/browser_ext_themes_lwtsupport.js (100%) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 8bb21ebe6748..521b6b70857a 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -65,9 +65,6 @@ pref("extensions.systemAddon.update.url", "https://aus5.mozilla.org/update/3/Sys // See the SCOPE constants in AddonManager.jsm for values to use here. pref("extensions.autoDisableScopes", 15); -// Whether or not webextension themes are supported. -pref("extensions.webextensions.themes.enabled", false); - // Add-on content security policies. pref("extensions.webextensions.base-content-security-policy", "script-src 'self' https://* moz-extension: blob: filesystem: 'unsafe-eval' 'unsafe-inline'; object-src 'self' https://* moz-extension: blob: filesystem:;"); pref("extensions.webextensions.default-content-security-policy", "script-src 'self'; object-src 'self';"); diff --git a/browser/components/extensions/extensions-browser.manifest b/browser/components/extensions/extensions-browser.manifest index d5a9446adc8a..353cb231b4c3 100644 --- a/browser/components/extensions/extensions-browser.manifest +++ b/browser/components/extensions/extensions-browser.manifest @@ -15,7 +15,6 @@ category webextension-scripts pageAction chrome://browser/content/ext-pageAction category webextension-scripts sessions chrome://browser/content/ext-sessions.js category webextension-scripts sidebarAction chrome://browser/content/ext-sidebarAction.js category webextension-scripts tabs chrome://browser/content/ext-tabs.js -category webextension-scripts theme chrome://browser/content/ext-theme.js category webextension-scripts url-overrides chrome://browser/content/ext-url-overrides.js category webextension-scripts utils chrome://browser/content/ext-utils.js category webextension-scripts windows chrome://browser/content/ext-windows.js @@ -46,6 +45,5 @@ category webextension-schemas page_action chrome://browser/content/schemas/page_ category webextension-schemas sessions chrome://browser/content/schemas/sessions.json category webextension-schemas sidebar_action chrome://browser/content/schemas/sidebar_action.json category webextension-schemas tabs chrome://browser/content/schemas/tabs.json -category webextension-schemas theme chrome://browser/content/schemas/theme.json category webextension-schemas url_overrides chrome://browser/content/schemas/url_overrides.json category webextension-schemas windows chrome://browser/content/schemas/windows.json diff --git a/browser/components/extensions/jar.mn b/browser/components/extensions/jar.mn index aaaf2bcaa4f2..56b082924b1e 100644 --- a/browser/components/extensions/jar.mn +++ b/browser/components/extensions/jar.mn @@ -28,7 +28,6 @@ browser.jar: content/browser/ext-sessions.js content/browser/ext-sidebarAction.js content/browser/ext-tabs.js - content/browser/ext-theme.js content/browser/ext-url-overrides.js content/browser/ext-utils.js content/browser/ext-windows.js diff --git a/browser/components/extensions/schemas/jar.mn b/browser/components/extensions/schemas/jar.mn index 07dfc1e4cdde..f27fb9a331a4 100644 --- a/browser/components/extensions/schemas/jar.mn +++ b/browser/components/extensions/schemas/jar.mn @@ -19,6 +19,5 @@ browser.jar: content/browser/schemas/sessions.json content/browser/schemas/sidebar_action.json content/browser/schemas/tabs.json - content/browser/schemas/theme.json content/browser/schemas/url_overrides.json content/browser/schemas/windows.json diff --git a/browser/components/extensions/test/browser/browser-common.ini b/browser/components/extensions/test/browser/browser-common.ini index a4676d81bd49..3de527ce012f 100644 --- a/browser/components/extensions/test/browser/browser-common.ini +++ b/browser/components/extensions/test/browser/browser-common.ini @@ -113,9 +113,6 @@ support-files = [browser_ext_tabs_update.js] [browser_ext_tabs_zoom.js] [browser_ext_tabs_update_url.js] -[browser_ext_themes_chromeparity.js] -[browser_ext_themes_dynamic_updates.js] -[browser_ext_themes_lwtsupport.js] [browser_ext_topwindowid.js] [browser_ext_url_overrides_all.js] [browser_ext_url_overrides_home.js] @@ -134,4 +131,4 @@ tags = fullscreen [browser_ext_windows_size.js] skip-if = os == 'mac' # Fails when windows are randomly opened in fullscreen mode [browser_ext_windows_update.js] -tags = fullscreen \ No newline at end of file +tags = fullscreen diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 0f9851d54355..04f77786b65d 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -4791,6 +4791,8 @@ pref("extensions.webextensions.keepStorageOnUninstall", false); pref("extensions.webextensions.keepUuidOnUninstall", false); // Redirect basedomain used by identity api pref("extensions.webextensions.identity.redirectDomain", "extensions.allizom.org"); +// Whether or not webextension themes are supported. +pref("extensions.webextensions.themes.enabled", false); pref("extensions.webextensions.remote", false); // Report Site Issue button diff --git a/browser/components/extensions/ext-theme.js b/toolkit/components/extensions/ext-theme.js similarity index 100% rename from browser/components/extensions/ext-theme.js rename to toolkit/components/extensions/ext-theme.js diff --git a/toolkit/components/extensions/extensions-toolkit.manifest b/toolkit/components/extensions/extensions-toolkit.manifest index ea135f999e2d..4ebaf777f672 100644 --- a/toolkit/components/extensions/extensions-toolkit.manifest +++ b/toolkit/components/extensions/extensions-toolkit.manifest @@ -4,33 +4,34 @@ category webextension-scripts backgroundPage chrome://extensions/content/ext-bac category webextension-scripts contextualIdentities chrome://extensions/content/ext-contextualIdentities.js category webextension-scripts cookies chrome://extensions/content/ext-cookies.js category webextension-scripts downloads chrome://extensions/content/ext-downloads.js +category webextension-scripts extension chrome://extensions/content/ext-extension.js category webextension-scripts geolocation chrome://extensions/content/ext-geolocation.js -category webextension-scripts management chrome://extensions/content/ext-management.js -category webextension-scripts notifications chrome://extensions/content/ext-notifications.js +category webextension-scripts handlers chrome://extensions/content/ext-protocolHandlers.js category webextension-scripts i18n chrome://extensions/content/ext-i18n.js category webextension-scripts idle chrome://extensions/content/ext-idle.js -category webextension-scripts webRequest chrome://extensions/content/ext-webRequest.js -category webextension-scripts webNavigation chrome://extensions/content/ext-webNavigation.js -category webextension-scripts handlers chrome://extensions/content/ext-protocolHandlers.js -category webextension-scripts runtime chrome://extensions/content/ext-runtime.js -category webextension-scripts extension chrome://extensions/content/ext-extension.js -category webextension-scripts storage chrome://extensions/content/ext-storage.js -category webextension-scripts topSites chrome://extensions/content/ext-topSites.js +category webextension-scripts management chrome://extensions/content/ext-management.js +category webextension-scripts notifications chrome://extensions/content/ext-notifications.js category webextension-scripts privacy chrome://extensions/content/ext-privacy.js +category webextension-scripts runtime chrome://extensions/content/ext-runtime.js +category webextension-scripts storage chrome://extensions/content/ext-storage.js +category webextension-scripts theme chrome://extensions/content/ext-theme.js +category webextension-scripts topSites chrome://extensions/content/ext-topSites.js +category webextension-scripts webNavigation chrome://extensions/content/ext-webNavigation.js +category webextension-scripts webRequest chrome://extensions/content/ext-webRequest.js # scripts specific for content process. category webextension-scripts-content extension chrome://extensions/content/ext-c-extension.js category webextension-scripts-content i18n chrome://extensions/content/ext-i18n.js category webextension-scripts-content runtime chrome://extensions/content/ext-c-runtime.js -category webextension-scripts-content test chrome://extensions/content/ext-c-test.js category webextension-scripts-content storage chrome://extensions/content/ext-c-storage.js +category webextension-scripts-content test chrome://extensions/content/ext-c-test.js # scripts specific for devtools extension contexts. category webextension-scripts-devtools extension chrome://extensions/content/ext-c-extension.js category webextension-scripts-devtools i18n chrome://extensions/content/ext-i18n.js category webextension-scripts-devtools runtime chrome://extensions/content/ext-c-runtime.js -category webextension-scripts-devtools test chrome://extensions/content/ext-c-test.js category webextension-scripts-devtools storage chrome://extensions/content/ext-c-storage.js +category webextension-scripts-devtools test chrome://extensions/content/ext-c-test.js # scripts that must run in the same process as addon code. category webextension-scripts-addon backgroundPage chrome://extensions/content/ext-c-backgroundPage.js @@ -40,8 +41,8 @@ category webextension-scripts-addon i18n chrome://extensions/content/ext-i18n.js category webextension-scripts-addon identity chrome://extensions/content/ext-c-identity.js #endif category webextension-scripts-addon runtime chrome://extensions/content/ext-c-runtime.js -category webextension-scripts-addon test chrome://extensions/content/ext-c-test.js category webextension-scripts-addon storage chrome://extensions/content/ext-c-storage.js +category webextension-scripts-addon test chrome://extensions/content/ext-c-test.js # schemas category webextension-schemas alarms chrome://extensions/content/schemas/alarms.json @@ -64,6 +65,7 @@ category webextension-schemas privacy chrome://extensions/content/schemas/privac category webextension-schemas runtime chrome://extensions/content/schemas/runtime.json category webextension-schemas storage chrome://extensions/content/schemas/storage.json category webextension-schemas test chrome://extensions/content/schemas/test.json +category webextension-schemas theme chrome://extensions/content/schemas/theme.json category webextension-schemas top_sites chrome://extensions/content/schemas/top_sites.json category webextension-schemas types chrome://extensions/content/schemas/types.json category webextension-schemas web_navigation chrome://extensions/content/schemas/web_navigation.json diff --git a/toolkit/components/extensions/jar.mn b/toolkit/components/extensions/jar.mn index 6b652c2cb7c9..9d511e6f30dd 100644 --- a/toolkit/components/extensions/jar.mn +++ b/toolkit/components/extensions/jar.mn @@ -10,19 +10,22 @@ toolkit.jar: content/extensions/ext-contextualIdentities.js content/extensions/ext-cookies.js content/extensions/ext-downloads.js + content/extensions/ext-extension.js content/extensions/ext-geolocation.js - content/extensions/ext-management.js - content/extensions/ext-notifications.js content/extensions/ext-i18n.js content/extensions/ext-idle.js - content/extensions/ext-webRequest.js - content/extensions/ext-webNavigation.js + content/extensions/ext-management.js + content/extensions/ext-notifications.js + content/extensions/ext-privacy.js content/extensions/ext-protocolHandlers.js content/extensions/ext-runtime.js - content/extensions/ext-extension.js content/extensions/ext-storage.js + content/extensions/ext-theme.js content/extensions/ext-topSites.js - content/extensions/ext-privacy.js + content/extensions/ext-webRequest.js + content/extensions/ext-webNavigation.js + # Below is a separate group using the naming convention ext-c-*.js that run + # in the child process. content/extensions/ext-c-backgroundPage.js content/extensions/ext-c-extension.js #ifndef ANDROID diff --git a/toolkit/components/extensions/moz.build b/toolkit/components/extensions/moz.build index 35e2999f808f..3570bf2d8243 100644 --- a/toolkit/components/extensions/moz.build +++ b/toolkit/components/extensions/moz.build @@ -37,6 +37,10 @@ DIRS += ['schemas'] JAR_MANIFESTS += ['jar.mn'] +BROWSER_CHROME_MANIFESTS += [ + 'test/browser/browser.ini', +] + MOCHITEST_MANIFESTS += [ 'test/mochitest/mochitest-remote.ini', 'test/mochitest/mochitest.ini' diff --git a/toolkit/components/extensions/schemas/jar.mn b/toolkit/components/extensions/schemas/jar.mn index 01f0257dc825..8c1f29eb0fed 100644 --- a/toolkit/components/extensions/schemas/jar.mn +++ b/toolkit/components/extensions/schemas/jar.mn @@ -26,6 +26,7 @@ toolkit.jar: content/extensions/schemas/runtime.json content/extensions/schemas/storage.json content/extensions/schemas/test.json + content/extensions/schemas/theme.json content/extensions/schemas/top_sites.json content/extensions/schemas/types.json content/extensions/schemas/web_navigation.json diff --git a/browser/components/extensions/schemas/theme.json b/toolkit/components/extensions/schemas/theme.json similarity index 100% rename from browser/components/extensions/schemas/theme.json rename to toolkit/components/extensions/schemas/theme.json diff --git a/toolkit/components/extensions/test/browser/.eslintrc.js b/toolkit/components/extensions/test/browser/.eslintrc.js new file mode 100644 index 000000000000..6863553a5565 --- /dev/null +++ b/toolkit/components/extensions/test/browser/.eslintrc.js @@ -0,0 +1,18 @@ +"use strict"; + +module.exports = { // eslint-disable-line no-undef + "extends": "../../../../../testing/mochitest/mochitest.eslintrc.js", + + "env": { + "webextensions": true, + }, + + "globals": { + "ExtensionTestUtils": false, + "XPCOMUtils": true, + }, + + "rules": { + "no-shadow": 0, + }, +}; diff --git a/toolkit/components/extensions/test/browser/browser.ini b/toolkit/components/extensions/test/browser/browser.ini new file mode 100644 index 000000000000..2c48f11304b8 --- /dev/null +++ b/toolkit/components/extensions/test/browser/browser.ini @@ -0,0 +1,3 @@ +[browser_ext_themes_chromeparity.js] +[browser_ext_themes_dynamic_updates.js] +[browser_ext_themes_lwtsupport.js] diff --git a/browser/components/extensions/test/browser/browser_ext_themes_chromeparity.js b/toolkit/components/extensions/test/browser/browser_ext_themes_chromeparity.js similarity index 100% rename from browser/components/extensions/test/browser/browser_ext_themes_chromeparity.js rename to toolkit/components/extensions/test/browser/browser_ext_themes_chromeparity.js diff --git a/browser/components/extensions/test/browser/browser_ext_themes_dynamic_updates.js b/toolkit/components/extensions/test/browser/browser_ext_themes_dynamic_updates.js similarity index 100% rename from browser/components/extensions/test/browser/browser_ext_themes_dynamic_updates.js rename to toolkit/components/extensions/test/browser/browser_ext_themes_dynamic_updates.js diff --git a/browser/components/extensions/test/browser/browser_ext_themes_lwtsupport.js b/toolkit/components/extensions/test/browser/browser_ext_themes_lwtsupport.js similarity index 100% rename from browser/components/extensions/test/browser/browser_ext_themes_lwtsupport.js rename to toolkit/components/extensions/test/browser/browser_ext_themes_lwtsupport.js