Bug 1366896, part 2 - Add and use Cc.Initialize method. r=krizsa
authorAndrew McCreight <continuation@gmail.com>
Wed, 24 May 2017 14:12:11 -0700
changeset 376135 ff26fa1ed97d43a8a63c6545219056fd8894b0bc
parent 376134 08aa23aacd835ada368f053b8e9248a992aa0618
child 376136 0b6969f89a2aa1b997070fae9b3b7eec7c60c230
push id32375
push userkwierso@gmail.com
push dateTue, 22 Aug 2017 22:40:30 +0000
treeherdermozilla-central@80fafbaaf848 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskrizsa
bugs1366896
milestone57.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 1366896, part 2 - Add and use Cc.Initialize method. r=krizsa MozReview-Commit-ID: Amqt9JsTMqG
js/xpconnect/idl/xpccomponents.idl
js/xpconnect/src/XPCComponents.cpp
testing/modules/AppInfo.jsm
--- a/js/xpconnect/idl/xpccomponents.idl
+++ b/js/xpconnect/idl/xpccomponents.idl
@@ -39,16 +39,18 @@ interface nsIXPCComponents_Interfaces : 
 
 /**
 * interface of Components.classes
 * (interesting stuff only reflected into JavaScript)
 */
 [scriptable, uuid(978ff520-d26c-11d2-9842-006008962422)]
 interface nsIXPCComponents_Classes : nsISupports
 {
+  // Make it so that |cid| gets mapped to |idString|.
+  void initialize(in nsIJSCID cid, in string idString);
 };
 
 /**
 * interface of Components.classesByID
 * (interesting stuff only reflected into JavaScript)
 */
 [scriptable, uuid(336a9590-4d19-11d3-9893-006008962422)]
 interface nsIXPCComponents_ClassesByID : nsISupports
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -749,16 +749,24 @@ nsXPCComponents_Classes::Resolve(nsIXPCo
                                                      JSPROP_RESOLVING);
                 }
             }
         }
     }
     return NS_OK;
 }
 
+NS_IMETHODIMP
+nsXPCComponents_Classes::Initialize(nsIJSCID* cid,
+                                    const char* str)
+{
+    return cid->Initialize(str);
+}
+
+
 /***************************************************************************/
 /***************************************************************************/
 /***************************************************************************/
 
 class nsXPCComponents_ClassesByID final :
   public nsIXPCComponents_ClassesByID,
   public nsIXPCScriptable,
   public nsIClassInfo
--- a/testing/modules/AppInfo.jsm
+++ b/testing/modules/AppInfo.jsm
@@ -124,10 +124,15 @@ this.updateAppInfo = function(options) {
         throw Cr.NS_ERROR_NO_AGGREGATION;
       }
 
       return currentAppInfo.QueryInterface(iid);
     },
   };
 
   registrar.registerFactory(id, "XULAppInfo", cid, factory);
+
+  // Ensure that Cc actually maps cid to the new shim AppInfo. This is
+  // needed when JSM global sharing is enabled, because some prior
+  // code may already have looked up |Cc[cid]|.
+  Cc.initialize(Cc[cid], cid);
 };