Bug 1278608. Just bail out of mozJSComponentLoader::LoadModule if it's called on a non-main thread. r=bholley
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 07 Jul 2016 20:08:25 -0400
changeset 304142 2b7c2618bc0320de21cf93cf116f12150cdd9465
parent 304141 038d7b021492e648483aba1f1291ad7e902d4611
child 304143 b77acaa22eaa9657293d885604b0126e51855da4
push id30414
push usercbook@mozilla.com
push dateFri, 08 Jul 2016 09:59:01 +0000
treeherdermozilla-central@45682df2d2d4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1278608
milestone50.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 1278608. Just bail out of mozJSComponentLoader::LoadModule if it's called on a non-main thread. r=bholley
js/xpconnect/loader/mozJSComponentLoader.cpp
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -340,16 +340,21 @@ ResolveModuleObjectProperty(JSContext* a
         }
     }
     return aModObj;
 }
 
 const mozilla::Module*
 mozJSComponentLoader::LoadModule(FileLocation& aFile)
 {
+    if (!NS_IsMainThread()) {
+        MOZ_ASSERT(false, "Don't use JS components off the main thread");
+        return nullptr;
+    }
+
     nsCOMPtr<nsIFile> file = aFile.GetBaseFile();
 
     nsCString spec;
     aFile.GetURIString(spec);
     ComponentLoaderInfo info(spec);
     nsresult rv = info.EnsureURI();
     NS_ENSURE_SUCCESS(rv, nullptr);