diff --git a/dom/bindings/CallbackObject.cpp b/dom/bindings/CallbackObject.cpp index 933529d95fe2..55469b7e73a7 100644 --- a/dom/bindings/CallbackObject.cpp +++ b/dom/bindings/CallbackObject.cpp @@ -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); } } diff --git a/js/xpconnect/src/XPCWrappedJSClass.cpp b/js/xpconnect/src/XPCWrappedJSClass.cpp index dd916d35da7e..88b5f1e5bea4 100644 --- a/js/xpconnect/src/XPCWrappedJSClass.cpp +++ b/js/xpconnect/src/XPCWrappedJSClass.cpp @@ -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()); diff --git a/js/xpconnect/src/xpcpublic.h b/js/xpconnect/src/xpcpublic.h index e841ab7bdeb8..aaae6a6f1160 100644 --- a/js/xpconnect/src/xpcpublic.h +++ b/js/xpconnect/src/xpcpublic.h @@ -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 diff --git a/js/xpconnect/wrappers/WrapperFactory.cpp b/js/xpconnect/wrappers/WrapperFactory.cpp index 28fe883629b4..716462604084 100644 --- a/js/xpconnect/wrappers/WrapperFactory.cpp +++ b/js/xpconnect/wrappers/WrapperFactory.cpp @@ -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. diff --git a/tools/code-coverage/nsCodeCoverage.cpp b/tools/code-coverage/nsCodeCoverage.cpp index e88970c821e4..7cd6dcf67277 100644 --- a/tools/code-coverage/nsCodeCoverage.cpp +++ b/tools/code-coverage/nsCodeCoverage.cpp @@ -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; } diff --git a/widget/windows/JumpListBuilder.cpp b/widget/windows/JumpListBuilder.cpp index 4e5ab7695835..1f66c4a97d2c 100644 --- a/widget/windows/JumpListBuilder.cpp +++ b/widget/windows/JumpListBuilder.cpp @@ -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; }