Bug 989373, part 8 - mLoaderGlobal is always null. r=kmag
authorAndrew McCreight <continuation@gmail.com>
Mon, 15 May 2017 15:51:20 -0700
changeset 359839 da7db7d677e7a1284645c4c729060892c5e60bfe
parent 359838 249446e1ed682cc2f16b2a80473a2546fa80e2f7
child 359840 b5d15ecde93a1476b54a180f6167499710937378
push id31859
push userihsiao@mozilla.com
push dateMon, 22 May 2017 03:28:26 +0000
treeherdermozilla-central@367944041b55 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs989373
milestone55.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 989373, part 8 - mLoaderGlobal is always null. r=kmag This field can be eliminated for now. MozReview-Commit-ID: 9xyxoTwBfXU
js/xpconnect/loader/mozJSComponentLoader.cpp
js/xpconnect/loader/mozJSComponentLoader.h
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -526,24 +526,19 @@ class FileMapAutoCloser
 };
 
 JSObject*
 mozJSComponentLoader::PrepareObjectForLocation(JSContext* aCx,
                                                nsIFile* aComponentFile,
                                                nsIURI* aURI,
                                                bool* aRealFile)
 {
-    bool createdNewGlobal = false;
     RootedObject globalObj(aCx);
 
-    if (!mLoaderGlobal) {
-        CreateLoaderGlobal(aCx, MapURIToAddonID(aURI), &globalObj);
-        if (globalObj)
-            createdNewGlobal = true;
-    }
+    CreateLoaderGlobal(aCx, MapURIToAddonID(aURI), &globalObj);
 
     // |thisObj| is the object we set properties on for a particular .jsm.
     // XXX Right now, thisObj is always globalObj, but if we start
     // sharing globals between jsms, they won't be the same.
     // See bug 1186409.
     RootedObject thisObj(aCx, globalObj);
     NS_ENSURE_TRUE(thisObj, nullptr);
 
@@ -585,17 +580,17 @@ mozJSComponentLoader::PrepareObjectForLo
     // Expose the URI from which the script was imported through a special
     // variable that we insert into the JSM.
     RootedString exposedUri(aCx, JS_NewStringCopyN(aCx, nativePath.get(), nativePath.Length()));
     NS_ENSURE_TRUE(exposedUri, nullptr);
 
     if (!JS_DefineProperty(aCx, thisObj, "__URI__", exposedUri, 0))
         return nullptr;
 
-    if (createdNewGlobal) {
+    {
         // AutoEntryScript required to invoke debugger hook, which is a
         // Gecko-specific concept at present.
         dom::AutoEntryScript aes(globalObj,
                                  "component loader report global");
         JS_FireOnNewGlobalObject(aes.cx(), globalObj);
     }
 
     return thisObj;
--- a/js/xpconnect/loader/mozJSComponentLoader.h
+++ b/js/xpconnect/loader/mozJSComponentLoader.h
@@ -81,17 +81,16 @@ class mozJSComponentLoader : public mozi
 
     nsresult ImportInto(const nsACString& aLocation,
                         JS::HandleObject targetObj,
                         JSContext* callercx,
                         JS::MutableHandleObject vp);
 
     nsCOMPtr<nsIComponentManager> mCompMgr;
     nsCOMPtr<nsIPrincipal> mSystemPrincipal;
-    nsCOMPtr<nsIXPConnectJSObjectHolder> mLoaderGlobal;
 
     class ModuleEntry : public mozilla::Module
     {
     public:
         explicit ModuleEntry(JS::RootingContext* aRootingCx)
           : mozilla::Module(), obj(aRootingCx), thisObjectKey(aRootingCx)
         {
             mVersion = mozilla::Module::kVersion;