Backed out changeset d950882eb6ce (bug 1285063)
authorIris Hsiao <ihsiao@mozilla.com>
Wed, 20 Jul 2016 17:01:05 +0800
changeset 305809 c0f1a96173fcbebe880279435cf62a428965bac0
parent 305808 6850035575f72f307da52235b503e6930212dddf
child 305810 a6ca570852571ae98ef10902af8bc9a27543383c
push id79665
push usercbook@mozilla.com
push dateWed, 20 Jul 2016 09:36:22 +0000
treeherdermozilla-inbound@744232e7c04a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1285063
milestone50.0a1
backs outd950882eb6ce5840a6bb65f7ff1d63e0941bc802
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset d950882eb6ce (bug 1285063)
CLOBBER
browser/components/extensions/extensions-browser.manifest
browser/components/extensions/moz.build
browser/components/nsBrowserGlue.js
mobile/android/chrome/content/browser.js
mobile/android/components/extensions/extensions-mobile.manifest
mobile/android/components/extensions/moz.build
toolkit/components/extensions/Extension.jsm
toolkit/components/extensions/ExtensionManagement.jsm
toolkit/components/extensions/extensions-toolkit.manifest
toolkit/components/extensions/moz.build
--- a/CLOBBER
+++ b/CLOBBER
@@ -17,9 +17,9 @@
 #
 # Modifying this file will now automatically clobber the buildbot machines \o/
 #
 
 # Are you updating CLOBBER because you think it's needed for your WebIDL
 # changes to stick? As of bug 928195, this shouldn't be necessary! Please
 # don't change CLOBBER for WebIDL changes any more.
 
-Bug 1285063 - Component manifest changes not getting picked up.
\ No newline at end of file
+Bug 911216 - followup from the backout to fix bustage
deleted file mode 100644
--- a/browser/components/extensions/extensions-browser.manifest
+++ /dev/null
@@ -1,22 +0,0 @@
-# scripts
-category webextension-scripts bookmarks chrome://browser/content/ext-bookmarks.js
-category webextension-scripts browserAction chrome://browser/content/ext-browserAction.js
-category webextension-scripts commands chrome://browser/content/ext-commands.js
-category webextension-scripts contextMenus chrome://browser/content/ext-contextMenus.js
-category webextension-scripts desktop-runtime chrome://browser/content/ext-desktop-runtime.js
-category webextension-scripts history chrome://browser/content/ext-history.js
-category webextension-scripts pageAction chrome://browser/content/ext-pageAction.js
-category webextension-scripts tabs chrome://browser/content/ext-tabs.js
-category webextension-scripts utils chrome://browser/content/ext-utils.js
-category webextension-scripts windows chrome://browser/content/ext-windows.js
-
-# schemas
-category webextension-schemas bookmarks chrome://browser/content/schemas/bookmarks.json
-category webextension-schemas browser_action chrome://browser/content/schemas/browser_action.json
-category webextension-schemas commands chrome://browser/content/schemas/commands.json
-category webextension-schemas context_menus chrome://browser/content/schemas/context_menus.json
-category webextension-schemas context_menus_internal chrome://browser/content/schemas/context_menus_internal.json
-category webextension-schemas history chrome://browser/content/schemas/history.json
-category webextension-schemas page_action chrome://browser/content/schemas/page_action.json
-category webextension-schemas tabs chrome://browser/content/schemas/tabs.json
-category webextension-schemas windows chrome://browser/content/schemas/windows.json
\ No newline at end of file
--- a/browser/components/extensions/moz.build
+++ b/browser/components/extensions/moz.build
@@ -1,16 +1,12 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 JAR_MANIFESTS += ['jar.mn']
 
-EXTRA_COMPONENTS += [
-    'extensions-browser.manifest',
-]
-
 DIRS += ['schemas']
 
 BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini']
 XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -153,16 +153,19 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource:///modules/ReaderParent.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "AddonWatcher",
                                   "resource://gre/modules/AddonWatcher.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
                                   "resource://gre/modules/LightweightThemeManager.jsm");
 
+XPCOMUtils.defineLazyModuleGetter(this, "ExtensionManagement",
+                                  "resource://gre/modules/ExtensionManagement.jsm");
+
 XPCOMUtils.defineLazyModuleGetter(this, "ShellService",
                                   "resource:///modules/ShellService.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "WindowsRegistry",
                                   "resource://gre/modules/WindowsRegistry.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(this, "WindowsUIUtils",
                                    "@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils");
@@ -552,16 +555,37 @@ BrowserGlue.prototype = {
     os.addObserver(this, "flash-plugin-hang", false);
     os.addObserver(this, "xpi-signature-changed", false);
     os.addObserver(this, "autocomplete-did-enter-text", false);
 
     if (AppConstants.NIGHTLY_BUILD) {
       os.addObserver(this, AddonWatcher.TOPIC_SLOW_ADDON_DETECTED, false);
     }
 
+    ExtensionManagement.registerScript("chrome://browser/content/ext-bookmarks.js");
+    ExtensionManagement.registerScript("chrome://browser/content/ext-browserAction.js");
+    ExtensionManagement.registerScript("chrome://browser/content/ext-commands.js");
+    ExtensionManagement.registerScript("chrome://browser/content/ext-contextMenus.js");
+    ExtensionManagement.registerScript("chrome://browser/content/ext-desktop-runtime.js");
+    ExtensionManagement.registerScript("chrome://browser/content/ext-history.js");
+    ExtensionManagement.registerScript("chrome://browser/content/ext-pageAction.js");
+    ExtensionManagement.registerScript("chrome://browser/content/ext-tabs.js");
+    ExtensionManagement.registerScript("chrome://browser/content/ext-utils.js");
+    ExtensionManagement.registerScript("chrome://browser/content/ext-windows.js");
+
+    ExtensionManagement.registerSchema("chrome://browser/content/schemas/bookmarks.json");
+    ExtensionManagement.registerSchema("chrome://browser/content/schemas/browser_action.json");
+    ExtensionManagement.registerSchema("chrome://browser/content/schemas/commands.json");
+    ExtensionManagement.registerSchema("chrome://browser/content/schemas/context_menus.json");
+    ExtensionManagement.registerSchema("chrome://browser/content/schemas/context_menus_internal.json");
+    ExtensionManagement.registerSchema("chrome://browser/content/schemas/history.json");
+    ExtensionManagement.registerSchema("chrome://browser/content/schemas/page_action.json");
+    ExtensionManagement.registerSchema("chrome://browser/content/schemas/tabs.json");
+    ExtensionManagement.registerSchema("chrome://browser/content/schemas/windows.json");
+
     this._flashHangCount = 0;
     this._firstWindowReady = new Promise(resolve => this._firstWindowLoaded = resolve);
   },
 
   // cleanup (called on application shutdown)
   _dispose: function BG__dispose() {
     let os = Services.obs;
     os.removeObserver(this, "notifications-open-settings");
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -89,16 +89,19 @@ XPCOMUtils.defineLazyServiceGetter(this,
 
 XPCOMUtils.defineLazyServiceGetter(this, "Profiler",
                                    "@mozilla.org/tools/profiler;1",
                                    "nsIProfiler");
 
 XPCOMUtils.defineLazyModuleGetter(this, "SimpleServiceDiscovery",
                                   "resource://gre/modules/SimpleServiceDiscovery.jsm");
 
+XPCOMUtils.defineLazyModuleGetter(this, "ExtensionManagement",
+                                  "resource://gre/modules/ExtensionManagement.jsm");
+
 XPCOMUtils.defineLazyModuleGetter(this, "CharsetMenu",
                                   "resource://gre/modules/CharsetMenu.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "NetErrorHelper",
                                   "resource://gre/modules/NetErrorHelper.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "PermissionsUtils",
                                   "resource://gre/modules/PermissionsUtils.jsm");
@@ -381,16 +384,22 @@ var BrowserApp = {
     Services.obs.addObserver(this, "android-get-pref", false);
     Services.obs.addObserver(this, "android-set-pref", false);
     Services.obs.addObserver(this, "gather-telemetry", false);
     Services.obs.addObserver(this, "keyword-search", false);
     Services.obs.addObserver(this, "sessionstore-state-purge-complete", false);
     Services.obs.addObserver(this, "Fonts:Reload", false);
     Services.obs.addObserver(this, "Vibration:Request", false);
 
+    // Register extension source files.
+    ExtensionManagement.registerScript("chrome://browser/content/ext-pageAction.js");
+
+    // Register extension schemas.
+    ExtensionManagement.registerSchema("chrome://browser/content/schemas/page_action.json");
+
     Messaging.addListener(this.getHistory.bind(this), "Session:GetHistory");
 
     function showFullScreenWarning() {
       Snackbars.show(Strings.browser.GetStringFromName("alertFullScreenToast"), Snackbars.LENGTH_LONG);
     }
 
     window.addEventListener("fullscreen", function() {
       Messaging.sendRequest({
@@ -6766,17 +6775,17 @@ var SearchEngines = {
               formData.push({ name: escape(formElement.name), value: escape(formElement.value) });
               break;
             }
           }
         }
       }
     };
 
-    // Return valid, pre-sorted queryParams.
+    // Return valid, pre-sorted queryParams. 
     return formData.filter(a => a.name && a.value).sort((a, b) => {
       // nsIBrowserSearchService.hasEngineWithURL() ensures sort, but this helps.
       if (a.name > b.name) {
         return 1;
       }
       if (b.name > a.name) {
         return -1;
       }
deleted file mode 100644
--- a/mobile/android/components/extensions/extensions-mobile.manifest
+++ /dev/null
@@ -1,5 +0,0 @@
-# scripts
-category webextension-scripts pageAction chrome://browser/content/ext-pageAction.js
-
-# schemas
-category webextension-schemas page_action chrome://browser/content/schemas/page_action.json
\ No newline at end of file
--- a/mobile/android/components/extensions/moz.build
+++ b/mobile/android/components/extensions/moz.build
@@ -1,15 +1,11 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 JAR_MANIFESTS += ['jar.mn']
 
-EXTRA_COMPONENTS += [
-    'extensions-mobile.manifest',
-]
-
 DIRS += ['schemas']
 
 MOCHITEST_CHROME_MANIFESTS += ['test/mochitest/chrome.ini']
\ No newline at end of file
--- a/toolkit/components/extensions/Extension.jsm
+++ b/toolkit/components/extensions/Extension.jsm
@@ -54,19 +54,48 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://gre/modules/AppConstants.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "MessageChannel",
                                   "resource://gre/modules/MessageChannel.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
                                   "resource://gre/modules/AddonManager.jsm");
 
 Cu.import("resource://gre/modules/ExtensionManagement.jsm");
 
+// Register built-in parts of the API. Other parts may be registered
+// in browser/, mobile/, or b2g/.
+ExtensionManagement.registerScript("chrome://extensions/content/ext-alarms.js");
+ExtensionManagement.registerScript("chrome://extensions/content/ext-backgroundPage.js");
+ExtensionManagement.registerScript("chrome://extensions/content/ext-cookies.js");
+ExtensionManagement.registerScript("chrome://extensions/content/ext-downloads.js");
+ExtensionManagement.registerScript("chrome://extensions/content/ext-notifications.js");
+ExtensionManagement.registerScript("chrome://extensions/content/ext-i18n.js");
+ExtensionManagement.registerScript("chrome://extensions/content/ext-idle.js");
+ExtensionManagement.registerScript("chrome://extensions/content/ext-runtime.js");
+ExtensionManagement.registerScript("chrome://extensions/content/ext-extension.js");
+ExtensionManagement.registerScript("chrome://extensions/content/ext-webNavigation.js");
+ExtensionManagement.registerScript("chrome://extensions/content/ext-webRequest.js");
+ExtensionManagement.registerScript("chrome://extensions/content/ext-storage.js");
+ExtensionManagement.registerScript("chrome://extensions/content/ext-test.js");
+
 const BASE_SCHEMA = "chrome://extensions/content/schemas/manifest.json";
-const CATEGORY_EXTENSION_SCHEMAS = "webextension-schemas";
-const CATEGORY_EXTENSION_SCRIPTS = "webextension-scripts";
+
+ExtensionManagement.registerSchema("chrome://extensions/content/schemas/alarms.json");
+ExtensionManagement.registerSchema("chrome://extensions/content/schemas/cookies.json");
+ExtensionManagement.registerSchema("chrome://extensions/content/schemas/downloads.json");
+ExtensionManagement.registerSchema("chrome://extensions/content/schemas/extension.json");
+ExtensionManagement.registerSchema("chrome://extensions/content/schemas/extension_types.json");
+ExtensionManagement.registerSchema("chrome://extensions/content/schemas/i18n.json");
+ExtensionManagement.registerSchema("chrome://extensions/content/schemas/idle.json");
+ExtensionManagement.registerSchema("chrome://extensions/content/schemas/notifications.json");
+ExtensionManagement.registerSchema("chrome://extensions/content/schemas/runtime.json");
+ExtensionManagement.registerSchema("chrome://extensions/content/schemas/storage.json");
+ExtensionManagement.registerSchema("chrome://extensions/content/schemas/test.json");
+ExtensionManagement.registerSchema("chrome://extensions/content/schemas/events.json");
+ExtensionManagement.registerSchema("chrome://extensions/content/schemas/web_navigation.json");
+ExtensionManagement.registerSchema("chrome://extensions/content/schemas/web_request.json");
 
 Cu.import("resource://gre/modules/ExtensionUtils.jsm");
 var {
   BaseContext,
   LocaleData,
   Messenger,
   injectAPI,
   instanceOf,
@@ -105,30 +134,28 @@ var Management = {
     if (this.initialized) {
       return this.initialized;
     }
 
     // Load order matters here. The base manifest defines types which are
     // extended by other schemas, so needs to be loaded first.
     let promise = Schemas.load(BASE_SCHEMA).then(() => {
       let promises = [];
-      for (let [/* name */, value] of XPCOMUtils.enumerateCategoryEntries(CATEGORY_EXTENSION_SCHEMAS)) {
-        promises.push(Schemas.load(value));
+      for (let schema of ExtensionManagement.getSchemas()) {
+        promises.push(Schemas.load(schema));
       }
       return Promise.all(promises);
     });
 
-    for (let [/* name */, value] of XPCOMUtils.enumerateCategoryEntries(CATEGORY_EXTENSION_SCRIPTS)) {
-      let scope = {
-        extensions: this,
-        global: scriptScope,
-        ExtensionContext: ExtensionContext,
-        GlobalManager: GlobalManager,
-      };
-      Services.scriptloader.loadSubScript(value, scope, "UTF-8");
+    for (let script of ExtensionManagement.getScripts()) {
+      let scope = {extensions: this,
+                   global: scriptScope,
+                   ExtensionContext: ExtensionContext,
+                   GlobalManager: GlobalManager};
+      Services.scriptloader.loadSubScript(script, scope, "UTF-8");
 
       // Save the scope to avoid it being garbage collected.
       this.scopes.push(scope);
     }
 
     this.initialized = promise;
     return this.initialized;
   },
--- a/toolkit/components/extensions/ExtensionManagement.jsm
+++ b/toolkit/components/extensions/ExtensionManagement.jsm
@@ -80,16 +80,42 @@ var Frames = {
       case "Extension:RemoveTopWindowID":
         this.topWindowIds.delete(data.windowId);
         break;
     }
   },
 };
 Frames.init();
 
+// Manage the collection of ext-*.js scripts that define the extension API.
+var Scripts = {
+  scripts: new Set(),
+
+  register(script) {
+    this.scripts.add(script);
+  },
+
+  getScripts() {
+    return this.scripts;
+  },
+};
+
+// Manage the collection of schemas/*.json schemas that define the extension API.
+var Schemas = {
+  schemas: new Set(),
+
+  register(schema) {
+    this.schemas.add(schema);
+  },
+
+  getSchemas() {
+    return this.schemas;
+  },
+};
+
 // This object manages various platform-level issues related to
 // moz-extension:// URIs. It lives here so that it can be used in both
 // the parent and child processes.
 //
 // moz-extension URIs have the form moz-extension://uuid/path. Each
 // extension has its own UUID, unique to the machine it's installed
 // on. This is easier and more secure than using the extension ID,
 // since it makes it slightly harder to fingerprint for extensions if
@@ -252,16 +278,22 @@ function getAPILevelForWindow(window, ad
   // WebExtension URLs loaded into top frames UI could have full API level privileges.
   return FULL_PRIVILEGES;
 }
 
 this.ExtensionManagement = {
   startupExtension: Service.startupExtension.bind(Service),
   shutdownExtension: Service.shutdownExtension.bind(Service),
 
+  registerScript: Scripts.register.bind(Scripts),
+  getScripts: Scripts.getScripts.bind(Scripts),
+
+  registerSchema: Schemas.register.bind(Schemas),
+  getSchemas: Schemas.getSchemas.bind(Schemas),
+
   getFrameId: Frames.getId.bind(Frames),
   getParentFrameId: Frames.getParentId.bind(Frames),
 
   // exported API Level Helpers
   getAddonIdForWindow,
   getAPILevelForWindow,
   API_LEVELS,
 };
deleted file mode 100644
--- a/toolkit/components/extensions/extensions-toolkit.manifest
+++ /dev/null
@@ -1,31 +0,0 @@
-# scripts
-category webextension-scripts alarms chrome://extensions/content/ext-alarms.js
-category webextension-scripts backgroundPage chrome://extensions/content/ext-backgroundPage.js
-category webextension-scripts cookies chrome://extensions/content/ext-cookies.js
-category webextension-scripts downloads chrome://extensions/content/ext-downloads.js
-category webextension-scripts notifications chrome://extensions/content/ext-notifications.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 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 test chrome://extensions/content/ext-test.js
-
-# schemas
-category webextension-schemas alarms chrome://extensions/content/schemas/alarms.json
-category webextension-schemas cookies chrome://extensions/content/schemas/cookies.json
-category webextension-schemas downloads chrome://extensions/content/schemas/downloads.json
-category webextension-schemas events chrome://extensions/content/schemas/events.json
-category webextension-schemas extension chrome://extensions/content/schemas/extension.json
-category webextension-schemas extension_types chrome://extensions/content/schemas/extension_types.json
-category webextension-schemas i18n chrome://extensions/content/schemas/i18n.json
-category webextension-schemas idle chrome://extensions/content/schemas/idle.json
-category webextension-schemas native_host_manifest chrome://extensions/content/schemas/native_host_manifest.json
-category webextension-schemas notifications chrome://extensions/content/schemas/notifications.json
-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 web_navigation chrome://extensions/content/schemas/web_navigation.json
-category webextension-schemas web_request chrome://extensions/content/schemas/web_request.json
\ No newline at end of file
--- a/toolkit/components/extensions/moz.build
+++ b/toolkit/components/extensions/moz.build
@@ -10,19 +10,15 @@ EXTRA_JS_MODULES += [
     'ExtensionManagement.jsm',
     'ExtensionStorage.jsm',
     'ExtensionUtils.jsm',
     'MessageChannel.jsm',
     'NativeMessaging.jsm',
     'Schemas.jsm',
 ]
 
-EXTRA_COMPONENTS += [
-    'extensions-toolkit.manifest',
-]
-
 DIRS += ['schemas']
 
 JAR_MANIFESTS += ['jar.mn']
 
 MOCHITEST_MANIFESTS += ['test/mochitest/mochitest.ini']
 MOCHITEST_CHROME_MANIFESTS += ['test/mochitest/chrome.ini']
 XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']