mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1474272 part 4 - Stop using js::GetGlobalForObjectCrossCompartment in xpc::NativeGlobal. r=bholley
This commit is contained in:
parent
cf8288afe6
commit
84036b8de4
@ -196,8 +196,7 @@ CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback,
|
||||
globalObject = win;
|
||||
} else {
|
||||
// No DOM Window. Store the global.
|
||||
JSObject* global = JS::GetNonCCWObjectGlobal(realCallback);
|
||||
globalObject = xpc::NativeGlobal(global);
|
||||
globalObject = xpc::NativeGlobal(realCallback);
|
||||
MOZ_ASSERT(globalObject);
|
||||
}
|
||||
}
|
||||
|
@ -549,8 +549,7 @@ nsXPCWrappedJSClass::DelegatedQueryInterface(nsXPCWrappedJS* self,
|
||||
// though we have derived nativeGlobal from the JS global, because we know
|
||||
// there are cases where this can happen. See bug 1094953.
|
||||
RootedObject obj(RootingCx(), self->GetJSObject());
|
||||
nsIGlobalObject* nativeGlobal =
|
||||
NativeGlobal(JS::GetNonCCWObjectGlobal(js::UncheckedUnwrap(obj)));
|
||||
nsIGlobalObject* nativeGlobal = NativeGlobal(js::UncheckedUnwrap(obj));
|
||||
NS_ENSURE_TRUE(nativeGlobal, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(nativeGlobal->GetGlobalJSObject(), NS_ERROR_FAILURE);
|
||||
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
|
||||
// definitely will be when we turn off XPConnect for the web.
|
||||
RootedObject obj(RootingCx(), wrapper->GetJSObject());
|
||||
nsIGlobalObject* nativeGlobal =
|
||||
NativeGlobal(JS::GetNonCCWObjectGlobal(js::UncheckedUnwrap(obj)));
|
||||
nsIGlobalObject* nativeGlobal = NativeGlobal(js::UncheckedUnwrap(obj));
|
||||
AutoEntryScript aes(nativeGlobal, "XPCWrappedJS method call",
|
||||
/* aIsMainThread = */ true);
|
||||
XPCCallContext ccx(aes.cx());
|
||||
|
@ -503,10 +503,12 @@ JSObject*
|
||||
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*
|
||||
NativeGlobal(JSObject* aObj);
|
||||
NativeGlobal(JSObject* obj);
|
||||
|
||||
/**
|
||||
* Returns the nsIGlobalObject corresponding to |cx|'s JS global. Must not be
|
||||
|
@ -673,7 +673,7 @@ TransplantObjectRetainingXrayExpandos(JSContext* cx, JS::HandleObject origobj,
|
||||
nsIGlobalObject*
|
||||
NativeGlobal(JSObject* obj)
|
||||
{
|
||||
obj = js::GetGlobalForObjectCrossCompartment(obj);
|
||||
obj = JS::GetNonCCWObjectGlobal(obj);
|
||||
|
||||
// Every global needs to hold a native as its private or be a
|
||||
// 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(NS_IsMainThread());
|
||||
|
||||
nsIGlobalObject* global = xpc::NativeGlobal(JS::CurrentGlobalOrNull(cx));
|
||||
nsIGlobalObject* global = xpc::CurrentNativeGlobal(cx);
|
||||
if (NS_WARN_IF(!global)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -185,9 +185,7 @@ NS_IMETHODIMP JumpListBuilder::InitListBuild(JSContext* aCx,
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
nsIGlobalObject* globalObject =
|
||||
xpc::NativeGlobal(JS::CurrentGlobalOrNull(aCx));
|
||||
|
||||
nsIGlobalObject* globalObject = xpc::CurrentNativeGlobal(aCx);
|
||||
if (NS_WARN_IF(!globalObject)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user