Bug 1524688: Part 18 - Convert presentation data channel stuff to static registration. r=smaug
☠☠ backed out by 3b1b94e39795 ☠ ☠
authorKris Maglione <maglione.k@gmail.com>
Tue, 29 Jan 2019 20:56:00 -0800
changeset 458991 ea347d57d73a
parent 458990 911689ef9f33
child 458992 d8efb5ed62b1
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)
reviewerssmaug
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 18 - Convert presentation data channel stuff to static registration. r=smaug
browser/installer/package-manifest.in
dom/presentation/PresentationDataChannelSessionTransport.js
dom/presentation/PresentationDataChannelSessionTransport.jsm
dom/presentation/PresentationDataChannelSessionTransport.manifest
dom/presentation/components.conf
dom/presentation/moz.build
dom/presentation/tests/mochitest/PresentationSessionFrameScript.js
mobile/android/installer/package-manifest.in
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -278,18 +278,16 @@
 @RESPATH@/defaults/pref/marionette.js
 #endif
 
 @RESPATH@/components/nsAsyncShutdown.manifest
 @RESPATH@/components/nsAsyncShutdown.js
 
 @RESPATH@/components/BuiltinProviders.manifest
 @RESPATH@/components/PresentationControlService.js
-@RESPATH@/components/PresentationDataChannelSessionTransport.js
-@RESPATH@/components/PresentationDataChannelSessionTransport.manifest
 
 @RESPATH@/components/mozIntl.manifest
 @RESPATH@/components/mozIntl.js
 
 #if defined(ENABLE_TESTS) && defined(MOZ_DEBUG)
 @RESPATH@/components/TestInterfaceJS.js
 @RESPATH@/components/TestInterfaceJS.manifest
 @RESPATH@/components/TestInterfaceJSMaplike.js
rename from dom/presentation/PresentationDataChannelSessionTransport.js
rename to dom/presentation/PresentationDataChannelSessionTransport.jsm
--- a/dom/presentation/PresentationDataChannelSessionTransport.js
+++ b/dom/presentation/PresentationDataChannelSessionTransport.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");
 
 // Bug 1228209 - plan to remove this eventually
 function log(aMsg) {
   // dump("-*- PresentationDataChannelSessionTransport.js : " + aMsg + "\n");
 }
 
 const PRESENTATIONTRANSPORT_CID = Components.ID("{dd2bbf2f-3399-4389-8f5f-d382afb8b2d6}");
@@ -367,10 +366,9 @@ PresentationTransport.prototype = {
       });
       reader.readAsBinaryString(aData);
     } else {
       this._callback.notifyData(aData, false);
     }
   },
 };
 
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PresentationTransportBuilder,
-                                                     PresentationTransport]);
+var EXPORTED_SYMBOLS = ["PresentationTransportBuilder", "PresentationTransport"];
deleted file mode 100644
--- a/dom/presentation/PresentationDataChannelSessionTransport.manifest
+++ /dev/null
@@ -1,6 +0,0 @@
-# PresentationDataChannelSessionTransport.js
-component {dd2bbf2f-3399-4389-8f5f-d382afb8b2d6} PresentationDataChannelSessionTransport.js
-contract @mozilla.org/presentation/datachanneltransport;1 {dd2bbf2f-3399-4389-8f5f-d382afb8b2d6}
-
-component {215b2f62-46e2-4004-a3d1-6858e56c20f3} PresentationDataChannelSessionTransport.js
-contract @mozilla.org/presentation/datachanneltransportbuilder;1 {215b2f62-46e2-4004-a3d1-6858e56c20f3}
new file mode 100644
--- /dev/null
+++ b/dom/presentation/components.conf
@@ -0,0 +1,20 @@
+# -*- 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': '{dd2bbf2f-3399-4389-8f5f-d382afb8b2d6}',
+        'contract_ids': ['@mozilla.org/presentation/datachanneltransport;1'],
+        'jsm': 'resource://gre/modules/PresentationDataChannelSessionTransport.jsm',
+        'constructor': 'PresentationTransport',
+    },
+    {
+        'cid': '{215b2f62-46e2-4004-a3d1-6858e56c20f3}',
+        'contract_ids': ['@mozilla.org/presentation/datachanneltransportbuilder;1'],
+        'jsm': 'resource://gre/modules/PresentationDataChannelSessionTransport.jsm',
+        'constructor': 'PresentationTransportBuilder',
+    },
+]
--- a/dom/presentation/moz.build
+++ b/dom/presentation/moz.build
@@ -55,19 +55,22 @@ UNIFIED_SOURCES += [
     'PresentationService.cpp',
     'PresentationSessionInfo.cpp',
     'PresentationSessionRequest.cpp',
     'PresentationTCPSessionTransport.cpp',
     'PresentationTerminateRequest.cpp',
     'PresentationTransportBuilderConstructor.cpp'
 ]
 
-EXTRA_COMPONENTS += [
-    'PresentationDataChannelSessionTransport.js',
-    'PresentationDataChannelSessionTransport.manifest',
+EXTRA_JS_MODULES += [
+    'PresentationDataChannelSessionTransport.jsm',
+]
+
+XPCOM_MANIFESTS += [
+    'components.conf',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
     EXTRA_COMPONENTS += [
         'PresentationNetworkHelper.js',
         'PresentationNetworkHelper.manifest',
     ]
 
--- a/dom/presentation/tests/mochitest/PresentationSessionFrameScript.js
+++ b/dom/presentation/tests/mochitest/PresentationSessionFrameScript.js
@@ -180,34 +180,31 @@ function loadPrivilegedScriptTest() {
     if (!registrar.isCIDRegistered(mockedClassId)) {
       try {
         originalClassId = registrar.contractIDToCID(contractId);
         originalFactory = Cm.getClassObject(Cc[contractId], Ci.nsIFactory);
       } catch (ex) {
         originalClassId = "";
         originalFactory = null;
       }
-      if (originalFactory) {
-        registrar.unregisterFactory(originalClassId, originalFactory);
-      }
       registrar.registerFactory(mockedClassId, "", contractId, mockedFactory);
     }
 
     return { contractId,
              mockedClassId,
              mockedFactory,
              originalClassId,
              originalFactory };
   }
 
   function registerOriginalFactory(contractId, mockedClassId, mockedFactory, originalClassId, originalFactory) {
     if (originalFactory) {
       var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
       registrar.unregisterFactory(mockedClassId, mockedFactory);
-      registrar.registerFactory(originalClassId, "", contractId, originalFactory);
+      registrar.registerFactory(originalClassId, "", contractId, null);
     }
   }
 
   /* Register mocked factories. */
   const originalFactoryData = [];
   const uuidGenerator = Cc["@mozilla.org/uuid-generator;1"]
                         .getService(Ci.nsIUUIDGenerator);
   originalFactoryData.push(registerMockedFactory("@mozilla.org/presentation/datachanneltransportbuilder;1",
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -190,18 +190,16 @@
 @BINPATH@/components/Downloads.manifest
 @BINPATH@/components/DownloadLegacy.js
 
 #ifndef MOZ_GECKOVIEW_JAR
 @BINPATH@/components/BuiltinProviders.manifest
 @BINPATH@/components/PresentationControlService.js
 @BINPATH@/components/PresentationNetworkHelper.js
 @BINPATH@/components/PresentationNetworkHelper.manifest
-@BINPATH@/components/PresentationDataChannelSessionTransport.js
-@BINPATH@/components/PresentationDataChannelSessionTransport.manifest
 @BINPATH@/components/AndroidCastDeviceProvider.manifest
 @BINPATH@/components/AndroidCastDeviceProvider.js
 #endif
 
 @BINPATH@/components/mozIntl.manifest
 @BINPATH@/components/mozIntl.js
 
 ; Modules