forked from mirrors/gecko-dev
Bug 1474272 part 4 - Stop using js::GetGlobalForObjectCrossCompartment in xpc::NativeGlobal. r=bholley
This commit is contained in:
parent
cf8288afe6
commit
84036b8de4
6 changed files with 10 additions and 13 deletions
|
|
@ -196,8 +196,7 @@ CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback,
|
||||||
globalObject = win;
|
globalObject = win;
|
||||||
} else {
|
} else {
|
||||||
// No DOM Window. Store the global.
|
// No DOM Window. Store the global.
|
||||||
JSObject* global = JS::GetNonCCWObjectGlobal(realCallback);
|
globalObject = xpc::NativeGlobal(realCallback);
|
||||||
globalObject = xpc::NativeGlobal(global);
|
|
||||||
MOZ_ASSERT(globalObject);
|
MOZ_ASSERT(globalObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -549,8 +549,7 @@ nsXPCWrappedJSClass::DelegatedQueryInterface(nsXPCWrappedJS* self,
|
||||||
// though we have derived nativeGlobal from the JS global, because we know
|
// though we have derived nativeGlobal from the JS global, because we know
|
||||||
// there are cases where this can happen. See bug 1094953.
|
// there are cases where this can happen. See bug 1094953.
|
||||||
RootedObject obj(RootingCx(), self->GetJSObject());
|
RootedObject obj(RootingCx(), self->GetJSObject());
|
||||||
nsIGlobalObject* nativeGlobal =
|
nsIGlobalObject* nativeGlobal = NativeGlobal(js::UncheckedUnwrap(obj));
|
||||||
NativeGlobal(JS::GetNonCCWObjectGlobal(js::UncheckedUnwrap(obj)));
|
|
||||||
NS_ENSURE_TRUE(nativeGlobal, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(nativeGlobal, NS_ERROR_FAILURE);
|
||||||
NS_ENSURE_TRUE(nativeGlobal->GetGlobalJSObject(), NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(nativeGlobal->GetGlobalJSObject(), NS_ERROR_FAILURE);
|
||||||
AutoEntryScript aes(nativeGlobal, "XPCWrappedJS QueryInterface",
|
AutoEntryScript aes(nativeGlobal, "XPCWrappedJS QueryInterface",
|
||||||
|
|
@ -947,8 +946,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex,
|
||||||
// AutoEntryScript. This is probably Gecko-specific at this point, and
|
// AutoEntryScript. This is probably Gecko-specific at this point, and
|
||||||
// definitely will be when we turn off XPConnect for the web.
|
// definitely will be when we turn off XPConnect for the web.
|
||||||
RootedObject obj(RootingCx(), wrapper->GetJSObject());
|
RootedObject obj(RootingCx(), wrapper->GetJSObject());
|
||||||
nsIGlobalObject* nativeGlobal =
|
nsIGlobalObject* nativeGlobal = NativeGlobal(js::UncheckedUnwrap(obj));
|
||||||
NativeGlobal(JS::GetNonCCWObjectGlobal(js::UncheckedUnwrap(obj)));
|
|
||||||
AutoEntryScript aes(nativeGlobal, "XPCWrappedJS method call",
|
AutoEntryScript aes(nativeGlobal, "XPCWrappedJS method call",
|
||||||
/* aIsMainThread = */ true);
|
/* aIsMainThread = */ true);
|
||||||
XPCCallContext ccx(aes.cx());
|
XPCCallContext ccx(aes.cx());
|
||||||
|
|
|
||||||
|
|
@ -503,10 +503,12 @@ JSObject*
|
||||||
CompilationScope();
|
CompilationScope();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the nsIGlobalObject corresponding to |aObj|'s JS global.
|
* Returns the nsIGlobalObject corresponding to |obj|'s JS global. |obj| must
|
||||||
|
* not be a cross-compartment wrapper: CCWs are not associated with a single
|
||||||
|
* global.
|
||||||
*/
|
*/
|
||||||
nsIGlobalObject*
|
nsIGlobalObject*
|
||||||
NativeGlobal(JSObject* aObj);
|
NativeGlobal(JSObject* obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the nsIGlobalObject corresponding to |cx|'s JS global. Must not be
|
* Returns the nsIGlobalObject corresponding to |cx|'s JS global. Must not be
|
||||||
|
|
|
||||||
|
|
@ -673,7 +673,7 @@ TransplantObjectRetainingXrayExpandos(JSContext* cx, JS::HandleObject origobj,
|
||||||
nsIGlobalObject*
|
nsIGlobalObject*
|
||||||
NativeGlobal(JSObject* obj)
|
NativeGlobal(JSObject* obj)
|
||||||
{
|
{
|
||||||
obj = js::GetGlobalForObjectCrossCompartment(obj);
|
obj = JS::GetNonCCWObjectGlobal(obj);
|
||||||
|
|
||||||
// Every global needs to hold a native as its private or be a
|
// Every global needs to hold a native as its private or be a
|
||||||
// WebIDL object with an nsISupports DOM object.
|
// WebIDL object with an nsISupports DOM object.
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ nsresult Request(JSContext* cx, Promise** aPromise, RequestType requestType)
|
||||||
MOZ_ASSERT(XRE_IsParentProcess());
|
MOZ_ASSERT(XRE_IsParentProcess());
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
nsIGlobalObject* global = xpc::NativeGlobal(JS::CurrentGlobalOrNull(cx));
|
nsIGlobalObject* global = xpc::CurrentNativeGlobal(cx);
|
||||||
if (NS_WARN_IF(!global)) {
|
if (NS_WARN_IF(!global)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -185,9 +185,7 @@ NS_IMETHODIMP JumpListBuilder::InitListBuild(JSContext* aCx,
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIGlobalObject* globalObject =
|
nsIGlobalObject* globalObject = xpc::CurrentNativeGlobal(aCx);
|
||||||
xpc::NativeGlobal(JS::CurrentGlobalOrNull(aCx));
|
|
||||||
|
|
||||||
if (NS_WARN_IF(!globalObject)) {
|
if (NS_WARN_IF(!globalObject)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue