Bug 971673: Assert that AutoJSAPI is always given a JSContext. r=bobowen
authorJim Blandy <jimb@mozilla.com>
Thu, 28 Aug 2014 10:00:56 -0700
changeset 223857 34e34990dfd6fcdf33f0191db436655d469ddf60
parent 223856 6f9a154cab406bb2ca68cd55a2f066dc6f7cac61
child 223858 b83ffe1314204bcfdf849145fa2be143c8a1a661
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbobowen
bugs971673
milestone34.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 971673: Assert that AutoJSAPI is always given a JSContext. r=bobowen
dom/base/ScriptSettings.cpp
--- a/dom/base/ScriptSettings.cpp
+++ b/dom/base/ScriptSettings.cpp
@@ -235,16 +235,17 @@ FindJSContext(nsIGlobalObject* aGlobalOb
 AutoJSAPI::AutoJSAPI()
   : mCx(nullptr)
 {
 }
 
 void
 AutoJSAPI::InitInternal(JSObject* aGlobal, JSContext* aCx, bool aIsMainThread)
 {
+  MOZ_ASSERT(aCx);
   mCx = aCx;
   if (aIsMainThread) {
     // This Rooted<> is necessary only as long as AutoCxPusher::AutoCxPusher
     // can GC, which is only possible because XPCJSContextStack::Push calls
     // nsIPrincipal.Equals. Once that is removed, the Rooted<> will no longer
     // be necessary.
     JS::Rooted<JSObject*> global(JS_GetRuntime(aCx), aGlobal);
     mCxPusher.emplace(mCx);