diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index fd6e1a3bc9d6..a03d15ebb5a2 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -1671,15 +1671,10 @@ nsContentUtils::GetWindowFromCaller() nsIDocument* nsContentUtils::GetDocumentFromCaller() { - JSContext *cx = nullptr; - JS::Rooted obj(cx); - sXPConnect->GetCaller(&cx, obj.address()); - NS_ASSERTION(cx && obj, "Caller ensures something is running"); - - JSAutoCompartment ac(cx, obj); + AutoJSContext cx; nsCOMPtr win = - do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(obj)); + do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(JS_GetGlobalForScopeChain(cx))); if (!win) { return nullptr; } diff --git a/js/xpconnect/idl/nsIXPConnect.idl b/js/xpconnect/idl/nsIXPConnect.idl index 0fb7a2e918a3..e430de9c2294 100644 --- a/js/xpconnect/idl/nsIXPConnect.idl +++ b/js/xpconnect/idl/nsIXPConnect.idl @@ -291,7 +291,7 @@ interface nsIXPCFunctionThisTranslator : nsISupports { 0xbd, 0xd6, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } } %} -[uuid(4498aa26-62df-4a4f-8a45-7ddfd7f84834)] +[uuid(dee6f80b-7ec5-4690-8622-a48af6a1ce52)] interface nsIXPConnect : nsISupports { %{ C++ @@ -609,12 +609,6 @@ interface nsIXPConnect : nsISupports nsIXPConnectJSObjectHolder holdObject(in JSContextPtr aJSContext, in JSObjectPtr aObject); - /** - * Return the caller object of the current call from JS. - */ - [noscript,notxpcom] void getCaller(out JSContextPtr aJSContext, - out JSObjectPtr aObject); - /** * When we place the browser in JS debug mode, there can't be any * JS on the stack. This is because we currently activate debugMode diff --git a/js/xpconnect/src/nsXPConnect.cpp b/js/xpconnect/src/nsXPConnect.cpp index 27d454e418d4..b5c3a75aba36 100644 --- a/js/xpconnect/src/nsXPConnect.cpp +++ b/js/xpconnect/src/nsXPConnect.cpp @@ -1346,16 +1346,6 @@ nsXPConnect::HoldObject(JSContext *aJSContext, JSObject *aObjectArg, return NS_OK; } -NS_IMETHODIMP_(void) -nsXPConnect::GetCaller(JSContext **aJSContext, JSObject **aObj) -{ - XPCCallContext *ccx = XPCJSRuntime::Get()->GetCallContext(); - *aJSContext = ccx->GetJSContext(); - - // Set to the caller in XPC_WN_Helper_{Call,Construct} - *aObj = ccx->GetFlattenedJSObject(); -} - namespace xpc { bool