From 666aaa00ac6ebfbee88c502207c1e6823f7c8c5e Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 4 Sep 2013 14:06:56 -0700 Subject: [PATCH] Bug 899367 - Remove xpc_UnmarkGrayContext. r=mccr8 Default compartment objects are never gray anymore. --- dom/base/nsJSEnvironment.cpp | 2 +- js/xpconnect/src/XPCWrappedJSClass.cpp | 2 +- js/xpconnect/src/nsCxPusher.cpp | 4 ---- js/xpconnect/src/nsXPConnect.cpp | 3 +-- js/xpconnect/src/xpcpublic.h | 20 -------------------- 5 files changed, 3 insertions(+), 28 deletions(-) diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 9e358f2f4ed3..423d0dea6f6c 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -1158,7 +1158,7 @@ nsJSContext::GetNativeGlobal() JSContext* nsJSContext::GetNativeContext() { - return xpc_UnmarkGrayContext(mContext); + return mContext; } nsresult diff --git a/js/xpconnect/src/XPCWrappedJSClass.cpp b/js/xpconnect/src/XPCWrappedJSClass.cpp index 0c563f4da6fc..f82b1455a5e5 100644 --- a/js/xpconnect/src/XPCWrappedJSClass.cpp +++ b/js/xpconnect/src/XPCWrappedJSClass.cpp @@ -1152,7 +1152,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex, return retval; XPCContext *xpcc = ccx.GetXPCContext(); - JSContext *cx = xpc_UnmarkGrayContext(ccx.GetJSContext()); + JSContext *cx = ccx.GetJSContext(); if (!cx || !xpcc || !IsReflectable(methodIndex)) return NS_ERROR_FAILURE; diff --git a/js/xpconnect/src/nsCxPusher.cpp b/js/xpconnect/src/nsCxPusher.cpp index b35082691d1a..b9be9343543d 100644 --- a/js/xpconnect/src/nsCxPusher.cpp +++ b/js/xpconnect/src/nsCxPusher.cpp @@ -124,9 +124,6 @@ AutoCxPusher::AutoCxPusher(JSContext* cx, bool allowNull) // Enter a request and a compartment for the duration that the cx is on the // stack if non-null. - // - // NB: We call UnmarkGrayContext so that this can obsolete the need for the - // old XPCAutoRequest as well. if (cx) { mAutoRequest.construct(cx); @@ -135,7 +132,6 @@ AutoCxPusher::AutoCxPusher(JSContext* cx, bool allowNull) : js::DefaultObjectForContextOrNull(cx); if (compartmentObject) mAutoCompartment.construct(cx, compartmentObject); - xpc_UnmarkGrayContext(cx); } } diff --git a/js/xpconnect/src/nsXPConnect.cpp b/js/xpconnect/src/nsXPConnect.cpp index 559c29bb933a..61ea9fb7fda2 100644 --- a/js/xpconnect/src/nsXPConnect.cpp +++ b/js/xpconnect/src/nsXPConnect.cpp @@ -1315,8 +1315,7 @@ xpc_ActivateDebugMode() JSContext* nsXPConnect::GetCurrentJSContext() { - JSContext *cx = GetRuntime()->GetJSContextStack()->Peek(); - return xpc_UnmarkGrayContext(cx); + return GetRuntime()->GetJSContextStack()->Peek(); } /* virtual */ diff --git a/js/xpconnect/src/xpcpublic.h b/js/xpconnect/src/xpcpublic.h index b36369032960..430791f2caef 100644 --- a/js/xpconnect/src/xpcpublic.h +++ b/js/xpconnect/src/xpcpublic.h @@ -24,7 +24,6 @@ #include "nsStringBuffer.h" #include "nsIGlobalObject.h" #include "mozilla/dom/BindingDeclarations.h" -#include "nsDOMJSUtils.h" class nsIPrincipal; class nsIXPConnectWrappedJS; @@ -164,25 +163,6 @@ xpc_UnmarkGrayScript(JSScript *script) return script; } -inline JSContext * -xpc_UnmarkGrayContext(JSContext *cx) -{ - // There's no default compartment object for DOM JSContexts, so we have - // nothing to do in that case. In fact, this whole function is obsolete, - // because nothing else is ever gray. But for now let's be deliberate. - // We'll remove this thing in the next patch. - if (cx && !GetScriptContextFromJSContext(cx)) { - JSObject *global = js::DefaultObjectForContextOrNull(cx); - xpc_UnmarkGrayObject(global); - if (global && JS_IsInRequest(JS_GetRuntime(cx))) { - JSObject *scope = JS::CurrentGlobalOrNull(cx); - if (scope != global) - xpc_UnmarkGrayObject(scope); - } - } - return cx; -} - // If aVariant is an XPCVariant, this marks the object to be in aGeneration. // This also unmarks the gray JSObject. extern void