Bug 1524688: Part 46 - Convert DNSServiceDiscovery to static registration. r=valentin
☠☠ backed out by 3b1b94e39795 ☠ ☠
authorKris Maglione <maglione.k@gmail.com>
Wed, 30 Jan 2019 11:12:55 -0800
changeset 459018 a9fb74beaf2b
parent 459017 fe106b369a72
child 459019 28105bf7bf6a
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 46 - Convert DNSServiceDiscovery to static registration. r=valentin Differential Revision: https://phabricator.services.mozilla.com/D18456
browser/installer/package-manifest.in
mobile/android/installer/package-manifest.in
netwerk/dns/mdns/libmdns/DNSServiceDiscovery.jsm
netwerk/dns/mdns/libmdns/components.conf
netwerk/dns/mdns/libmdns/moz.build
netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.js
netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.manifest
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -159,21 +159,16 @@
 #endif
 #endif
 
 ; JavaScript components
 @RESPATH@/components/ConsoleAPI.manifest
 @RESPATH@/components/ConsoleAPIStorage.js
 @RESPATH@/components/BrowserElementParent.manifest
 @RESPATH@/components/BrowserElementParent.js
-#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
 @RESPATH@/browser/components/aboutdebugging-registration.js
 @RESPATH@/browser/components/aboutdebugging.manifest
 #ifdef NIGHTLY_BUILD
 @RESPATH@/browser/components/aboutdebugging-new-registration.js
 @RESPATH@/browser/components/aboutdebugging-new.manifest
--- 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
-#ifndef MOZ_GECKOVIEW_JAR
-@BINPATH@/components/nsDNSServiceDiscovery.manifest
-@BINPATH@/components/nsDNSServiceDiscovery.js
-#endif
 @BINPATH@/components/toolkitsearch.manifest
 
 @BINPATH@/components/extensions.manifest
 
 #ifndef MOZ_GECKOVIEW_JAR
 @BINPATH@/components/amContentHandler.js
 @BINPATH@/components/amWebAPI.js
 @BINPATH@/components/amInstallTrigger.js
rename from netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.js
rename to netwerk/dns/mdns/libmdns/DNSServiceDiscovery.jsm
--- a/netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.js
+++ b/netwerk/dns/mdns/libmdns/DNSServiceDiscovery.jsm
@@ -1,24 +1,21 @@
 /* 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 {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 const {MulticastDNS} = ChromeUtils.import(
   (AppConstants.platform == "android" && !Services.prefs.getBoolPref("network.mdns.use_js_fallback"))
   ? "resource://gre/modules/MulticastDNSAndroid.jsm"
   : "resource://gre/modules/MulticastDNS.jsm");
 
-const DNSSERVICEDISCOVERY_CID = Components.ID("{f9346d98-f27a-4e89-b744-493843416480}");
-const DNSSERVICEDISCOVERY_CONTRACT_ID = "@mozilla.org/toolkit/components/mdnsresponder/dns-sd;1";
 const DNSSERVICEINFO_CONTRACT_ID = "@mozilla.org/toolkit/components/mdnsresponder/dns-info;1";
 
 function log(aMsg) {
   dump("-*- nsDNSServiceDiscovery.js : " + aMsg + "\n");
 }
 
 function generateUuid() {
   var uuidGenerator = Cc["@mozilla.org/uuid-generator;1"].
@@ -129,17 +126,16 @@ ListenerWrapper.prototype = {
 };
 
 function nsDNSServiceDiscovery() {
   log("nsDNSServiceDiscovery");
   this.mdns = new MulticastDNS();
 }
 
 nsDNSServiceDiscovery.prototype = {
-  classID: DNSSERVICEDISCOVERY_CID,
   QueryInterface: ChromeUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIDNSServiceDiscovery]),
 
   startDiscovery(aServiceType, aListener) {
     log("startDiscovery");
     let listener = new ListenerWrapper(aListener, this.mdns);
     listener.discoveryStarting = true;
     this.mdns.startDiscovery(aServiceType, listener);
 
@@ -174,17 +170,17 @@ nsDNSServiceDiscovery.prototype = {
   },
 
   resolveService(aServiceInfo, aListener) {
     log("resolveService");
     this.mdns.resolveService(aServiceInfo, new ListenerWrapper(aListener));
   },
 };
 
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsDNSServiceDiscovery]);
+var EXPORTED_SYMBOLS = ["nsDNSServiceDiscovery"];
 
 function _toPropertyBag2(obj) {
   if (obj.QueryInterface) {
     return obj.QueryInterface(Ci.nsIPropertyBag2);
   }
 
   let result = Cc["@mozilla.org/hash-property-bag;1"]
                   .createInstance(Ci.nsIWritablePropertyBag2);
--- a/netwerk/dns/mdns/libmdns/components.conf
+++ b/netwerk/dns/mdns/libmdns/components.conf
@@ -7,8 +7,18 @@
 Classes = [
     {
         'cid': '{14a50f2b-7ff6-48a5-88e3-615fd111f5d3}',
         'contract_ids': ['@mozilla.org/toolkit/components/mdnsresponder/dns-info;1'],
         'type': 'mozilla::net::nsDNSServiceInfo',
         'headers': ['/netwerk/dns/mdns/libmdns/nsDNSServiceInfo.h'],
     },
 ]
+
+if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] != 'cocoa':
+    Classes += [
+        {
+            'cid': '{f9346d98-f27a-4e89-b744-493843416480}',
+            'contract_ids': ['@mozilla.org/toolkit/components/mdnsresponder/dns-sd;1'],
+            'jsm': 'resource://gre/modules/DNSServiceDiscovery.jsm',
+            'constructor': 'nsDNSServiceDiscovery',
+        },
+    ]
--- a/netwerk/dns/mdns/libmdns/moz.build
+++ b/netwerk/dns/mdns/libmdns/moz.build
@@ -11,31 +11,31 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'coco
         'nsDNSServiceDiscovery.cpp',
     ]
 
     LOCAL_INCLUDES += [
       '/netwerk/base',
     ]
 
 else:
-    EXTRA_COMPONENTS += [
-        'nsDNSServiceDiscovery.js',
-        'nsDNSServiceDiscovery.manifest',
-    ]
-
     EXTRA_JS_MODULES += [
+        'DNSServiceDiscovery.jsm',
         'fallback/DataReader.jsm',
         'fallback/DataWriter.jsm',
         'fallback/DNSPacket.jsm',
         'fallback/DNSRecord.jsm',
         'fallback/DNSResourceRecord.jsm',
         'fallback/DNSTypes.jsm',
         'fallback/MulticastDNS.jsm',
     ]
 
+    XPCOM_MANIFESTS += [
+        'components.conf',
+    ]
+
     if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
         EXTRA_JS_MODULES += [
             'MulticastDNSAndroid.jsm',
         ]
 
 UNIFIED_SOURCES += [
     'nsDNSServiceInfo.cpp',
 ]
deleted file mode 100644
--- a/netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.manifest
+++ /dev/null
@@ -1,3 +0,0 @@
-# nsDNSServiceDiscovery.js
-component {f9346d98-f27a-4e89-b744-493843416480} nsDNSServiceDiscovery.js
-contract @mozilla.org/toolkit/components/mdnsresponder/dns-sd;1 {f9346d98-f27a-4e89-b744-493843416480}