Bug 1488677 - Backout part of bug 1485275 (changeset a8bd1c32fd2d) and register TransactionManager in common/. r=jorgk
authorGeoff Lankow <geoff@darktrojan.net>
Wed, 05 Sep 2018 22:06:54 +1200
changeset 33078 ed7240d36fb533b18059d841c60c6f2ab72a73f9
parent 33077 4a2af5ca975ba0eb97127e833ab35fb091086ef3
child 33079 0116db9a1764ef43ddf1bd1212538a2bafb95f2b
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersjorgk
bugs1488677, 1485275
Bug 1488677 - Backout part of bug 1485275 (changeset a8bd1c32fd2d) and register TransactionManager in common/. r=jorgk
calendar/base/src/calTransactionManager.js
common/public/moz.build
common/public/nsCommonBaseCID.h
common/public/nsITransactionManagerExtra.idl
common/src/moz.build
common/src/nsCommonModule.cpp
common/src/nsTransactionManagerExtra.cpp
common/src/nsTransactionManagerExtra.h
--- a/calendar/base/src/calTransactionManager.js
+++ b/calendar/base/src/calTransactionManager.js
@@ -3,19 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm", null);
 
 function calTransactionManager() {
     this.wrappedJSObject = this;
     if (!this.transactionManager) {
         this.transactionManager =
-            Cc["@mozilla.org/transaction-manager-extra;1"]
-                .getService(Ci.nsITransactionManagerExtra)
-                .createTransactionManager();
+            Cc["@mozilla.org/transactionmanager;1"].createInstance(Ci.nsITransactionManager);
     }
 }
 
 calTransactionManager.prototype = {
     QueryInterface: ChromeUtils.generateQI([Ci.calITransactionManager]),
     classID: Components.ID("{1d529847-d292-4222-b066-b8b17a794d62}"),
 
     transactionManager: null,
--- a/common/public/moz.build
+++ b/common/public/moz.build
@@ -1,15 +1,14 @@
 # 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/.
 
 XPIDL_SOURCES += [
     'nsIComponentManagerExtra.idl',
-    'nsITransactionManagerExtra.idl',
 ]
 
 XPIDL_MODULE = 'msgcommonbase'
 
 EXPORTS += [
     'nsCommonBaseCID.h'
 ]
--- a/common/public/nsCommonBaseCID.h
+++ b/common/public/nsCommonBaseCID.h
@@ -9,18 +9,17 @@
 #include "nsIFactory.h"
 #include "nsIComponentManager.h"
 
 // nsComponentManagerExtra
 #define NS_COMPONENTMANAGEREXTRA_CONTRACTID "@mozilla.org/component-manager-extra;1"
 #define NS_COMPONENTMANAGEREXTRA_CID \
   { 0xb4359b53, 0x3060, 0x46ff, { 0xad, 0x42, 0xe6, 0x7e, 0xea, 0x6c, 0xcf, 0x59 } }
 
-// nsTransactionManagerExtra
-#define NS_TRANSACTIONMANAGEREXTRA_CONTRACTID "@mozilla.org/transaction-manager-extra;1"
-#define NS_TRANSACTIONMANAGEREXTRA_CID \
-  { 0x837d20c4, 0x7cbd, 0x4c42, { 0x9f, 0xf9, 0x86, 0x46, 0x6d, 0x4e, 0xd5, 0xfd } }
-
 #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 } }
+
 #endif // nsCommonBaseCID_h__
deleted file mode 100644
--- a/common/public/nsITransactionManagerExtra.idl
+++ /dev/null
@@ -1,12 +0,0 @@
-/* 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/. */
-
-#include "nsISupports.idl"
-#include "nsITransactionManager.idl"
-
-[scriptable, uuid(d1265f8e-e8ea-482e-9b58-0949cd1d83c0)]
-interface nsITransactionManagerExtra : nsISupports
-{
-  nsITransactionManager createTransactionManager();
-};
--- a/common/src/moz.build
+++ b/common/src/moz.build
@@ -7,12 +7,11 @@ EXTRA_JS_MODULES += [
     'ChromeManifest.jsm',
     'extensionSupport.jsm',
     'Overlays.jsm'
 ]
 
 SOURCES += [
     'nsCommonModule.cpp',
     'nsComponentManagerExtra.cpp',
-    'nsTransactionManagerExtra.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
--- a/common/src/nsCommonModule.cpp
+++ b/common/src/nsCommonModule.cpp
@@ -1,38 +1,40 @@
 /* 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/. */
 
 #include "mozilla/ModuleUtils.h"
+#include "mozilla/TransactionManager.h"
 #include "nsBaseCommandController.h"
 #include "nsCommonBaseCID.h"
 #include "nsComponentManagerExtra.h"
-#include "nsTransactionManagerExtra.h"
+
+using mozilla::TransactionManager;
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsComponentManagerExtra)
 NS_DEFINE_NAMED_CID(NS_COMPONENTMANAGEREXTRA_CID);
 
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransactionManagerExtra)
-NS_DEFINE_NAMED_CID(NS_TRANSACTIONMANAGEREXTRA_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);
+
 const mozilla::Module::CIDEntry kCommonCIDs[] = {
   { &kNS_COMPONENTMANAGEREXTRA_CID, false, nullptr, nsComponentManagerExtraConstructor },
-  { &kNS_TRANSACTIONMANAGEREXTRA_CID, false, nullptr, nsTransactionManagerExtraConstructor },
   { &kNS_BASECOMMANDCONTROLLER_CID, false, nullptr, nsBaseCommandControllerConstructor },
+  { &kNS_TRANSACTIONMANAGER_CID, false, nullptr, TransactionManagerConstructor },
   { nullptr }
 };
 
 const mozilla::Module::ContractIDEntry kCommonContracts[] = {
   { NS_COMPONENTMANAGEREXTRA_CONTRACTID, &kNS_COMPONENTMANAGEREXTRA_CID },
-  { NS_TRANSACTIONMANAGEREXTRA_CONTRACTID, &kNS_TRANSACTIONMANAGEREXTRA_CID },
   { NS_BASECOMMANDCONTROLLER_CONTRACTID, &kNS_BASECOMMANDCONTROLLER_CID },
+  { NS_TRANSACTIONMANAGER_CONTRACTID, &kNS_TRANSACTIONMANAGER_CID },
   { nullptr }
 };
 
 static const mozilla::Module kCommonModule = {
   mozilla::Module::kVersion,
   kCommonCIDs,
   kCommonContracts,
   nullptr,
deleted file mode 100644
--- a/common/src/nsTransactionManagerExtra.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/* 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/. */
-
-#include "nsCommonBaseCID.h"
-#include "nsTransactionManagerExtra.h"
-#include "mozilla/TransactionManager.h"
-
-NS_IMPL_ISUPPORTS(nsTransactionManagerExtra,
-                  nsITransactionManagerExtra)
-
-NS_IMETHODIMP
-nsTransactionManagerExtra::CreateTransactionManager(nsITransactionManager** aManager)
-{
-  NS_ENSURE_ARG_POINTER(aManager);
-  nsCOMPtr<nsITransactionManager> manager = new mozilla::TransactionManager();
-  manager.forget(aManager);
-  return NS_OK;
-}
-
-nsTransactionManagerExtra::~nsTransactionManagerExtra()
-{
-}
deleted file mode 100644
--- a/common/src/nsTransactionManagerExtra.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* 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/. */
-#ifndef nsTransactionManagerExtra_h__
-#define nsTransactionManagerExtra_h__
-
-#include "nsITransactionManagerExtra.h"
-
-class nsTransactionManagerExtra : public nsITransactionManagerExtra
-{
-public:
-
-  NS_DECL_THREADSAFE_ISUPPORTS
-  NS_DECL_NSITRANSACTIONMANAGEREXTRA
-
-private:
-  virtual ~nsTransactionManagerExtra();
-};
-
-#endif // nsTransactionManagerExtra_h__