зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1512655 part 2 - Assert Cu.setWantXrays is never called on system-principal scopes. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D14695 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
84fe725407
Коммит
7fa54ccf51
|
@ -458,6 +458,8 @@ interface nsIXPCComponents_Utils : nsISupports
|
||||||
*
|
*
|
||||||
* Enables Xray vision for same-compartment access for the compartment
|
* Enables Xray vision for same-compartment access for the compartment
|
||||||
* indicated by |vscope|. All outgoing wrappers are recomputed.
|
* indicated by |vscope|. All outgoing wrappers are recomputed.
|
||||||
|
*
|
||||||
|
* This must not be called on chrome (system-principal) scopes.
|
||||||
*/
|
*/
|
||||||
[implicit_jscontext]
|
[implicit_jscontext]
|
||||||
void setWantXrays(in jsval vscope);
|
void setWantXrays(in jsval vscope);
|
||||||
|
|
|
@ -1978,9 +1978,8 @@ nsXPCComponents_Utils::SetWantXrays(HandleValue vscope, JSContext* cx) {
|
||||||
return NS_ERROR_INVALID_ARG;
|
return NS_ERROR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
JSObject* scopeObj = js::UncheckedUnwrap(&vscope.toObject());
|
JSObject* scopeObj = js::UncheckedUnwrap(&vscope.toObject());
|
||||||
MOZ_DIAGNOSTIC_ASSERT(
|
MOZ_RELEASE_ASSERT(!AccessCheck::isChrome(scopeObj),
|
||||||
!mozJSComponentLoader::Get()->IsLoaderGlobal(scopeObj),
|
"Don't call setWantXrays on system-principal scopes");
|
||||||
"Don't call Cu.setWantXrays() in a JSM that shares its global");
|
|
||||||
JS::Compartment* compartment = js::GetObjectCompartment(scopeObj);
|
JS::Compartment* compartment = js::GetObjectCompartment(scopeObj);
|
||||||
CompartmentPrivate::Get(scopeObj)->wantXrays = true;
|
CompartmentPrivate::Get(scopeObj)->wantXrays = true;
|
||||||
bool ok = js::RecomputeWrappers(cx, js::SingleCompartment(compartment),
|
bool ok = js::RecomputeWrappers(cx, js::SingleCompartment(compartment),
|
||||||
|
|
Загрузка…
Ссылка в новой задаче