зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1514672 part 2 - Use the scripted caller's global instead of the context global in a few more places. r=bzbarsky
This fixes some test failures exposed by the previous patch. Differential Revision: https://phabricator.services.mozilla.com/D14850 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
af4a060def
Коммит
cf908f9f73
|
@ -1766,7 +1766,7 @@ nsresult nsXPCComponents_utils_Sandbox::CallOrConstruct(
|
|||
|
||||
if (options.metadata.isNullOrUndefined()) {
|
||||
// If the caller is running in a sandbox, inherit.
|
||||
RootedObject callerGlobal(cx, CurrentGlobalOrNull(cx));
|
||||
RootedObject callerGlobal(cx, JS::GetScriptedCallerGlobal(cx));
|
||||
if (IsSandbox(callerGlobal)) {
|
||||
rv = GetSandboxMetadata(cx, callerGlobal, &options.metadata);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
|
|
@ -1994,12 +1994,12 @@ nsXPCComponents_Utils::SetWantXrays(HandleValue vscope, JSContext* cx) {
|
|||
NS_IMETHODIMP
|
||||
nsXPCComponents_Utils::ForcePermissiveCOWs(JSContext* cx) {
|
||||
xpc::CrashIfNotInAutomation();
|
||||
RootedObject currentGlobal(cx, CurrentGlobalOrNull(cx));
|
||||
RootedObject global(cx, GetScriptedCallerGlobal(cx));
|
||||
MOZ_ASSERT(global);
|
||||
MOZ_DIAGNOSTIC_ASSERT(
|
||||
!mozJSComponentLoader::Get()->IsLoaderGlobal(currentGlobal),
|
||||
!mozJSComponentLoader::Get()->IsLoaderGlobal(global),
|
||||
"Don't call Cu.forcePermissiveCOWs() in a JSM that shares its global");
|
||||
MOZ_RELEASE_ASSERT(currentGlobal == JS::GetScriptedCallerGlobal(cx));
|
||||
RealmPrivate::Get(currentGlobal)->forcePermissiveCOWs = true;
|
||||
RealmPrivate::Get(global)->forcePermissiveCOWs = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,9 +39,10 @@ Module::~Module() = default;
|
|||
NS_IMETHODIMP
|
||||
Module::Call(nsIXPConnectWrappedNative* wrapper, JSContext* cx, JSObject* obj,
|
||||
const JS::CallArgs& args, bool* _retval) {
|
||||
JS::Rooted<JSObject*> global(cx, JS::CurrentGlobalOrNull(cx));
|
||||
JS::Rooted<JSObject*> global(cx, JS::GetScriptedCallerGlobal(cx));
|
||||
if (!global) return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
JSAutoRealm ar(cx, global);
|
||||
*_retval = JS_InitReflectParse(cx, global);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче