Bug 1275999 part 4. Change XPCJSContextStack::Push to return void. r=bholley
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 27 May 2016 09:53:32 -0400
changeset 338343 8cab033c0e0b01536bdc1e85fa7fd0f798219165
parent 338342 1d9e42ddcd59520042665e769c46c8d2a50a5981
child 338344 ce020eaf0e1e350ada9aea1c0922cd2d475f3cf6
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1275999
milestone49.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 1275999 part 4. Change XPCJSContextStack::Push to return void. r=bholley
dom/base/ScriptSettings.cpp
js/xpconnect/src/XPCJSContextStack.cpp
js/xpconnect/src/nsXPConnect.cpp
js/xpconnect/src/xpcprivate.h
--- a/dom/base/ScriptSettings.cpp
+++ b/dom/base/ScriptSettings.cpp
@@ -776,19 +776,17 @@ danger::AutoCxPusher::AutoCxPusher(JSCon
 
   // Hold a strong ref to the nsIScriptContext, if any. This ensures that we
   // only destroy the mContext of an nsJSContext when it is not on the cx stack
   // (and therefore not in use). See nsJSContext::DestroyJSContext().
   if (cx)
     mScx = GetScriptContextFromJSContext(cx);
 
   XPCJSContextStack *stack = XPCJSRuntime::Get()->GetJSContextStack();
-  if (!stack->Push(cx)) {
-    MOZ_CRASH();
-  }
+  stack->Push(cx);
   mStackDepthAfterPush = stack->Count();
 
 #ifdef DEBUG
   mPushedContext = cx;
   mCompartmentDepthOnEntry = cx ? js::GetEnterCompartmentDepth(cx) : 0;
 #endif
 
   // Enter a request and a compartment for the duration that the cx is on the
--- a/js/xpconnect/src/XPCJSContextStack.cpp
+++ b/js/xpconnect/src/XPCJSContextStack.cpp
@@ -43,22 +43,21 @@ XPCJSContextStack::Pop()
         newTop = nullptr;
     } else {
         newTop = mStack[idx-1];
     }
     js::Debug_SetActiveJSContext(mRuntime->Runtime(), newTop);
     return cx;
 }
 
-bool
+void
 XPCJSContextStack::Push(JSContext* cx)
 {
     js::Debug_SetActiveJSContext(mRuntime->Runtime(), cx);
     mStack.AppendElement(cx);
-    return true;
 }
 
 JSContext*
 XPCJSContextStack::GetSafeJSContext()
 {
     MOZ_ASSERT(mSafeJSContext);
     return mSafeJSContext;
 }
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -989,20 +989,20 @@ nsXPConnect::GetCurrentJSContext()
 JSContext*
 nsXPConnect::GetSafeJSContext()
 {
     return GetRuntime()->GetJSContextStack()->GetSafeJSContext();
 }
 
 namespace xpc {
 
-bool
+void
 PushNullJSContext()
 {
-    return XPCJSRuntime::Get()->GetJSContextStack()->Push(nullptr);
+    XPCJSRuntime::Get()->GetJSContextStack()->Push(nullptr);
 }
 
 void
 PopNullJSContext()
 {
     MOZ_ASSERT(XPCJSRuntime::Get()->GetJSContextStack()->Peek() == nullptr);
     XPCJSRuntime::Get()->GetJSContextStack()->Pop();
 }
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -2763,17 +2763,17 @@ private:
 };
 
 
 /***************************************************************************/
 // XPCJSContextStack is not actually an xpcom object, but xpcom calls are
 // delegated to it as an implementation detail.
 
 namespace xpc {
-bool PushNullJSContext();
+void PushNullJSContext();
 void PopNullJSContext();
 
 } /* namespace xpc */
 
 namespace mozilla {
 namespace dom {
 namespace danger {
 class AutoCxPusher;
@@ -2801,23 +2801,23 @@ public:
         return mStack.IsEmpty() ? nullptr : mStack[mStack.Length() - 1];
     }
 
     JSContext* InitSafeJSContext();
     JSContext* GetSafeJSContext();
 
 private:
     friend class mozilla::dom::danger::AutoCxPusher;
-    friend bool xpc::PushNullJSContext();
+    friend void xpc::PushNullJSContext();
     friend void xpc::PopNullJSContext();
 
     // We make these private so that stack manipulation can only happen
     // through one of the above friends.
     JSContext* Pop();
-    bool Push(JSContext* cx);
+    void Push(JSContext* cx);
 
     AutoTArray<JSContext*, 16> mStack;
     XPCJSRuntime* mRuntime;
     JSContext*  mSafeJSContext;
 };
 
 /***************************************************************************/
 // 'Components' object implementations. nsXPCComponentsBase has the