Bug 1524688: Part 45 - Convert network HTTP JS components to static registration. r=valentin
☠☠ backed out by 3b1b94e39795 ☠ ☠
authorKris Maglione <maglione.k@gmail.com>
Wed, 30 Jan 2019 11:09:50 -0800
changeset 459017 fe106b369a72
parent 459016 e657e77d4271
child 459018 a9fb74beaf2b
push id111909
push usermaglione.k@gmail.com
push dateThu, 14 Feb 2019 02:30:40 +0000
treeherdermozilla-inbound@81dc12cc9257 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1524688
milestone67.0a1
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
Bug 1524688: Part 45 - Convert network HTTP JS components to static registration. r=valentin Differential Revision: https://phabricator.services.mozilla.com/D18455
browser/installer/package-manifest.in
mobile/android/installer/package-manifest.in
netwerk/protocol/http/UAOverridesBootstrapper.js
netwerk/protocol/http/UAOverridesBootstrapper.jsm
netwerk/protocol/http/UAOverridesBootstrapper.manifest
netwerk/protocol/http/WellKnownOpportunisticUtils.js
netwerk/protocol/http/WellKnownOpportunisticUtils.jsm
netwerk/protocol/http/WellKnownOpportunisticUtils.manifest
netwerk/protocol/http/components.conf
netwerk/protocol/http/moz.build
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -159,20 +159,16 @@
 #endif
 #endif
 
 ; JavaScript components
 @RESPATH@/components/ConsoleAPI.manifest
 @RESPATH@/components/ConsoleAPIStorage.js
 @RESPATH@/components/BrowserElementParent.manifest
 @RESPATH@/components/BrowserElementParent.js
-@RESPATH@/components/UAOverridesBootstrapper.js
-@RESPATH@/components/UAOverridesBootstrapper.manifest
-@RESPATH@/components/WellKnownOpportunisticUtils.js
-@RESPATH@/components/WellKnownOpportunisticUtils.manifest
 #ifndef XP_MACOSX
 ; OSX uses native platform impl.  Windows, Linux, and Android uses fallback JS impl.
 @BINPATH@/components/nsDNSServiceDiscovery.manifest
 @BINPATH@/components/nsDNSServiceDiscovery.js
 #endif
 @RESPATH@/browser/components/BrowserComponents.manifest
 @RESPATH@/browser/components/devtools-startup.manifest
 @RESPATH@/browser/components/devtools-startup.js
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -105,20 +105,16 @@
 @BINPATH@/components/ConsoleAPIStorage.js
 @BINPATH@/components/NotificationStorage.js
 @BINPATH@/components/NotificationStorage.manifest
 #ifdef MOZ_ANDROID_GCM
 @BINPATH@/components/Push.manifest
 #endif
 @BINPATH@/components/BrowserElementParent.manifest
 @BINPATH@/components/BrowserElementParent.js
-@BINPATH@/components/UAOverridesBootstrapper.js
-@BINPATH@/components/UAOverridesBootstrapper.manifest
-@BINPATH@/components/WellKnownOpportunisticUtils.js
-@BINPATH@/components/WellKnownOpportunisticUtils.manifest
 #ifndef MOZ_GECKOVIEW_JAR
 @BINPATH@/components/nsDNSServiceDiscovery.manifest
 @BINPATH@/components/nsDNSServiceDiscovery.js
 #endif
 @BINPATH@/components/toolkitsearch.manifest
 
 @BINPATH@/components/extensions.manifest
 
rename from netwerk/protocol/http/UAOverridesBootstrapper.js
rename to netwerk/protocol/http/UAOverridesBootstrapper.jsm
--- a/netwerk/protocol/http/UAOverridesBootstrapper.js
+++ b/netwerk/protocol/http/UAOverridesBootstrapper.jsm
@@ -1,15 +1,14 @@
 /* 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/. */
 
 "use strict";
 
-const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 const {UserAgentOverrides} = ChromeUtils.import("resource://gre/modules/UserAgentOverrides.jsm");
 
 function UAOverridesBootstrapper() {
   this.init();
 }
 
 UAOverridesBootstrapper.prototype = {
@@ -24,10 +23,9 @@ UAOverridesBootstrapper.prototype = {
       UserAgentOverrides.uninit();
     }
   },
 
   QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]),
   classID: Components.ID("{965b0ca8-155b-11e7-93ae-92361f002671}"),
 };
 
-const components = [UAOverridesBootstrapper];
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
+var EXPORTED_SYMBOLS = ["UAOverridesBootstrapper"];
deleted file mode 100644
--- a/netwerk/protocol/http/UAOverridesBootstrapper.manifest
+++ /dev/null
@@ -1,3 +0,0 @@
-# UAOverridesBootstrapper.js
-component {965b0ca8-155b-11e7-93ae-92361f002671} UAOverridesBootstrapper.js process=main
-contract @mozilla.org/network/ua-overrides-bootstrapper;1 {965b0ca8-155b-11e7-93ae-92361f002671} process=main
rename from netwerk/protocol/http/WellKnownOpportunisticUtils.js
rename to netwerk/protocol/http/WellKnownOpportunisticUtils.jsm
--- a/netwerk/protocol/http/WellKnownOpportunisticUtils.js
+++ b/netwerk/protocol/http/WellKnownOpportunisticUtils.jsm
@@ -1,30 +1,22 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* 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/. */
 
 "use strict";
 
-const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-const WELLKNOWNOPPORTUNISTICUTILS_CONTRACTID = "@mozilla.org/network/well-known-opportunistic-utils;1";
-const WELLKNOWNOPPORTUNISTICUTILS_CID = Components.ID("{b4f96c89-5238-450c-8bda-e12c26f1d150}");
-
 function WellKnownOpportunisticUtils() {
   this.valid = false;
   this.mixed = false;
   this.lifetime = 0;
 }
 
 WellKnownOpportunisticUtils.prototype = {
-  classID: WELLKNOWNOPPORTUNISTICUTILS_CID,
-  contractID: WELLKNOWNOPPORTUNISTICUTILS_CONTRACTID,
-  classDescription: "Well-Known Opportunistic Utils",
   QueryInterface: ChromeUtils.generateQI([Ci.nsIWellKnownOpportunisticUtils]),
 
   verify(aJSON, aOrigin, aAlternatePort) {
     try {
       let obj = JSON.parse(aJSON.toLowerCase());
       let ports = obj[aOrigin.toLowerCase()]["tls-ports"];
       if (!ports.includes(aAlternatePort)) {
         throw "invalid port";
@@ -33,9 +25,9 @@ WellKnownOpportunisticUtils.prototype = 
       this.mixed = obj[aOrigin.toLowerCase()]["mixed-scheme"];
     } catch (e) {
       return;
     }
     this.valid = true;
   },
 };
 
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([WellKnownOpportunisticUtils]);
+var EXPORTED_SYMBOLS = ["WellKnownOpportunisticUtils"];
deleted file mode 100644
--- a/netwerk/protocol/http/WellKnownOpportunisticUtils.manifest
+++ /dev/null
@@ -1,3 +0,0 @@
-# WellKnownOpportunisticUtils.js
-component {b4f96c89-5238-450c-8bda-e12c26f1d150} WellKnownOpportunisticUtils.js
-contract @mozilla.org/network/well-known-opportunistic-utils;1 {b4f96c89-5238-450c-8bda-e12c26f1d150}
new file mode 100644
--- /dev/null
+++ b/netwerk/protocol/http/components.conf
@@ -0,0 +1,21 @@
+# -*- Mode: python; 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/.
+
+Classes = [
+    {
+        'cid': '{965b0ca8-155b-11e7-93ae-92361f002671}',
+        'contract_ids': ['@mozilla.org/network/ua-overrides-bootstrapper;1'],
+        'jsm': 'resource://gre/modules/UAOverridesBootstrapper.jsm',
+        'constructor': 'UAOverridesBootstrapper',
+        'processes': ProcessSelector.MAIN_PROCESS_ONLY,
+    },
+    {
+        'cid': '{b4f96c89-5238-450c-8bda-e12c26f1d150}',
+        'contract_ids': ['@mozilla.org/network/well-known-opportunistic-utils;1'],
+        'jsm': 'resource://gre/modules/WellKnownOpportunisticUtils.jsm',
+        'constructor': 'WellKnownOpportunisticUtils',
+    },
+]
--- a/netwerk/protocol/http/moz.build
+++ b/netwerk/protocol/http/moz.build
@@ -133,21 +133,23 @@ FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '/dom/base',
     '/extensions/auth',
     '/netwerk/base',
     '/netwerk/cookie',
     '/netwerk/url-classifier',
 ]
 
-EXTRA_COMPONENTS += [
-    'UAOverridesBootstrapper.js',
-    'UAOverridesBootstrapper.manifest',
-    'WellKnownOpportunisticUtils.js',
-    'WellKnownOpportunisticUtils.manifest',
+EXTRA_JS_MODULES += [
+    'UAOverridesBootstrapper.jsm',
+    'WellKnownOpportunisticUtils.jsm',
+]
+
+XPCOM_MANIFESTS += [
+    'components.conf',
 ]
 
 if CONFIG['OS_TARGET'] == 'Darwin':
     if not CONFIG['HOST_MAJOR_VERSION']:
         DEFINES.update(
             HAS_CONNECTX=True,
         )
     elif CONFIG['HOST_MAJOR_VERSION'] >= '15':