Bug 1301189 - Use ExposeObjectToActiveJS in nsModuleScript. r=smaug
authorAndrew McCreight <continuation@gmail.com>
Wed, 07 Sep 2016 14:39:34 -0700
changeset 354691 dbeaca20e104c0a13281896dcb6a1cda63b32ba9
parent 354690 59b665a08aabaa66c8c2c966c9194155a825752b
child 354692 f770a12324d77e69b830234da9392b91892600f7
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1301189
milestone51.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 1301189 - Use ExposeObjectToActiveJS in nsModuleScript. r=smaug These GC things can be passed to the JS engine, so we should make sure they are not marked gray. MozReview-Commit-ID: GJDogXSuqYh
dom/base/nsScriptLoader.cpp
--- a/dom/base/nsScriptLoader.cpp
+++ b/dom/base/nsScriptLoader.cpp
@@ -309,18 +309,28 @@ public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsModuleScript)
 
   nsModuleScript(nsScriptLoader* aLoader,
                  nsIURI* aBaseURL,
                  JS::Handle<JSObject*> aModuleRecord);
 
   nsScriptLoader* Loader() const { return mLoader; }
-  JSObject* ModuleRecord() const { return mModuleRecord; }
-  JS::Value Exception() const { return mException; }
+  JSObject* ModuleRecord() const
+  {
+    if (mModuleRecord) {
+      JS::ExposeObjectToActiveJS(mModuleRecord);
+    }
+    return mModuleRecord;
+  }
+  JS::Value Exception() const
+  {
+    JS::ExposeValueToActiveJS(mException);
+    return mException;
+  }
   nsIURI* BaseURL() const { return mBaseURL; }
 
   void SetInstantiationResult(JS::Handle<JS::Value> aMaybeException);
   bool IsUninstantiated() const {
     return mInstantiationState == Uninstantiated;
   }
   bool IsInstantiated() const {
     return mInstantiationState == Instantiated;