Bug 1501718 - Port bug 1501404, part 7: Move XPCOM registration of nsSyncStreamListener to C-C common/. rs=bustage-fix
authorJorg K <jorgk@jorgk.com>
Wed, 24 Oct 2018 21:11:27 +0200
changeset 33567 97c5ad955dd4cc7e162cc418af4248aff595a5ce
parent 33566 d79573211d8fea1ab085f703587da7391c257b52
child 33568 50a2faafdfbfebbf5291d0df17b8976b1d957a31
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersbustage-fix
bugs1501718, 1501404
Bug 1501718 - Port bug 1501404, part 7: Move XPCOM registration of nsSyncStreamListener to C-C common/. rs=bustage-fix
common/public/nsCommonBaseCID.h
common/src/moz.build
common/src/nsCommonModule.cpp
--- a/common/public/nsCommonBaseCID.h
+++ b/common/public/nsCommonBaseCID.h
@@ -17,9 +17,13 @@
 #define NS_BASECOMMANDCONTROLLER_CONTRACTID "@mozilla.org/embedcomp/base-command-controller;1"
 #define NS_BASECOMMANDCONTROLLER_CID \
   { 0xbf88b48c, 0xfd8e, 0x40b4, { 0xba, 0x36, 0xc7, 0xc3, 0xad, 0x6d, 0x8a, 0xc9 } }
 
 #define NS_TRANSACTIONMANAGER_CONTRACTID "@mozilla.org/transactionmanager;1"
 #define NS_TRANSACTIONMANAGER_CID \
   { 0x9c8f9601, 0x801a, 0x11d2, { 0x98, 0xba, 0x0, 0x80, 0x5f, 0x29, 0x7d, 0x89 } }
 
+#define NS_SYNCSTREAMLISTENER_CONTRACTID "@mozilla.org/network/sync-stream-listener;1"
+#define NS_SYNCSTREAMLISTENER_CID \
+  { 0x439400d3, 0x6f23, 0x43db, {0x8b, 0x06, 0x8a, 0xaf, 0xe1, 0x86, 0x9b, 0xd8 } }
+
 #endif // nsCommonBaseCID_h__
--- a/common/src/moz.build
+++ b/common/src/moz.build
@@ -9,9 +9,13 @@ EXTRA_JS_MODULES += [
     'Overlays.jsm'
 ]
 
 SOURCES += [
     'nsCommonModule.cpp',
     'nsComponentManagerExtra.cpp',
 ]
 
+LOCAL_INCLUDES += [
+  '/%s/netwerk/base' % CONFIG['mozreltopsrcdir']
+]
+
 FINAL_LIBRARY = 'xul'
--- a/common/src/nsCommonModule.cpp
+++ b/common/src/nsCommonModule.cpp
@@ -2,39 +2,61 @@
  * 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/. */
 
 #include "mozilla/ModuleUtils.h"
 #include "mozilla/TransactionManager.h"
 #include "nsBaseCommandController.h"
 #include "nsCommonBaseCID.h"
 #include "nsComponentManagerExtra.h"
+#include "nsSyncStreamListener.h"
 
 using mozilla::TransactionManager;
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsComponentManagerExtra)
 NS_DEFINE_NAMED_CID(NS_COMPONENTMANAGEREXTRA_CID);
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsBaseCommandController)
 NS_DEFINE_NAMED_CID(NS_BASECOMMANDCONTROLLER_CID);
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(TransactionManager)
 NS_DEFINE_NAMED_CID(NS_TRANSACTIONMANAGER_CID);
 
+NS_DEFINE_NAMED_CID(NS_SYNCSTREAMLISTENER_CID);
+
+static nsresult
+CreateNewSyncStreamListener(nsISupports *aOuter, REFNSIID aIID, void **aResult)
+{
+  NS_ENSURE_ARG_POINTER(aResult);
+  *aResult = nullptr;
+
+  if (aOuter) {
+    return NS_ERROR_NO_AGGREGATION;
+  }
+
+  RefPtr<nsISyncStreamListener> inst = nsSyncStreamListener::Create();
+  if (!inst)
+    return NS_ERROR_NULL_POINTER;
+
+  return inst->QueryInterface(aIID, aResult);
+}
+
 const mozilla::Module::CIDEntry kCommonCIDs[] = {
   { &kNS_COMPONENTMANAGEREXTRA_CID, false, nullptr, nsComponentManagerExtraConstructor },
   { &kNS_BASECOMMANDCONTROLLER_CID, false, nullptr, nsBaseCommandControllerConstructor },
   { &kNS_TRANSACTIONMANAGER_CID, false, nullptr, TransactionManagerConstructor },
+  { &kNS_SYNCSTREAMLISTENER_CID, false, nullptr, CreateNewSyncStreamListener },
   { nullptr }
 };
 
 const mozilla::Module::ContractIDEntry kCommonContracts[] = {
   { NS_COMPONENTMANAGEREXTRA_CONTRACTID, &kNS_COMPONENTMANAGEREXTRA_CID },
   { NS_BASECOMMANDCONTROLLER_CONTRACTID, &kNS_BASECOMMANDCONTROLLER_CID },
   { NS_TRANSACTIONMANAGER_CONTRACTID, &kNS_TRANSACTIONMANAGER_CID },
+  { NS_SYNCSTREAMLISTENER_CONTRACTID, &kNS_SYNCSTREAMLISTENER_CID },
   { nullptr }
 };
 
 static const mozilla::Module kCommonModule = {
   mozilla::Module::kVersion,
   kCommonCIDs,
   kCommonContracts,
   nullptr,