Bug 899367 - Remove check for non-WindowProxy objects on an scx. r=mccr8

This commit is contained in:
Bobby Holley 2013-09-04 14:06:56 -07:00
parent 401b0ffa0b
commit d5a3220b2a

View File

@ -880,19 +880,18 @@ CycleCollectedJSRuntime::UsefulToMergeZones() const
JSContext* cx;
JSAutoRequest ar(nsContentUtils::GetSafeJSContext());
while ((cx = JS_ContextIterator(mJSRuntime, &iter))) {
// Skip anything without an nsIScriptContext, as well as any scx whose
// NativeGlobal() is not an outer window (this happens with XUL Prototype
// compilation scopes, for example, which we're not interested in).
// Skip anything without an nsIScriptContext.
nsIScriptContext* scx = GetScriptContextFromJSContext(cx);
JS::RootedObject global(cx, scx ? scx->GetWindowProxyPreserveColor() : nullptr);
if (!global || !js::GetObjectParent(global)) {
JS::RootedObject obj(cx, scx ? scx->GetWindowProxyPreserveColor() : nullptr);
if (!obj) {
continue;
}
MOZ_ASSERT(js::IsOuterObject(obj));
// Grab the inner from the outer.
global = JS_ObjectToInnerObject(cx, global);
MOZ_ASSERT(!js::GetObjectParent(global));
if (JS::GCThingIsMarkedGray(global) &&
!js::IsSystemCompartment(js::GetObjectCompartment(global))) {
obj = JS_ObjectToInnerObject(cx, obj);
MOZ_ASSERT(!js::GetObjectParent(obj));
if (JS::GCThingIsMarkedGray(obj) &&
!js::IsSystemCompartment(js::GetObjectCompartment(obj))) {
return true;
}
}