Bug 899367 - Remove xpc_UnmarkGrayContext. r=mccr8

Default compartment objects are never gray anymore.
This commit is contained in:
Bobby Holley 2013-09-04 14:06:56 -07:00
parent cd5d9ae05f
commit d63ea4fbcc
5 changed files with 3 additions and 28 deletions

View File

@ -1158,7 +1158,7 @@ nsJSContext::GetNativeGlobal()
JSContext*
nsJSContext::GetNativeContext()
{
return xpc_UnmarkGrayContext(mContext);
return mContext;
}
nsresult

View File

@ -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;

View File

@ -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);
}
}

View File

@ -1315,8 +1315,7 @@ xpc_ActivateDebugMode()
JSContext*
nsXPConnect::GetCurrentJSContext()
{
JSContext *cx = GetRuntime()->GetJSContextStack()->Peek();
return xpc_UnmarkGrayContext(cx);
return GetRuntime()->GetJSContextStack()->Peek();
}
/* virtual */

View File

@ -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