mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
Bug 940639 - Fix rooting hazard in nsXPCComponents_Utils::(Un)blockScriptForGlobal() r=bholley
This commit is contained in:
parent
e37996118d
commit
4d65d888cb
@ -3381,8 +3381,8 @@ nsXPCComponents_Utils::BlockScriptForGlobal(const JS::Value &globalArg,
|
||||
JSContext *cx)
|
||||
{
|
||||
NS_ENSURE_TRUE(globalArg.isObject(), NS_ERROR_INVALID_ARG);
|
||||
JSObject *global = UncheckedUnwrap(&globalArg.toObject(),
|
||||
/* stopAtOuter = */ false);
|
||||
RootedObject global(cx, UncheckedUnwrap(&globalArg.toObject(),
|
||||
/* stopAtOuter = */ false));
|
||||
NS_ENSURE_TRUE(JS_IsGlobalObject(global), NS_ERROR_INVALID_ARG);
|
||||
if (nsContentUtils::IsSystemPrincipal(GetObjectPrincipal(global))) {
|
||||
JS_ReportError(cx, "Script may not be disabled for system globals");
|
||||
@ -3397,8 +3397,8 @@ nsXPCComponents_Utils::UnblockScriptForGlobal(const JS::Value &globalArg,
|
||||
JSContext *cx)
|
||||
{
|
||||
NS_ENSURE_TRUE(globalArg.isObject(), NS_ERROR_INVALID_ARG);
|
||||
JSObject *global = UncheckedUnwrap(&globalArg.toObject(),
|
||||
/* stopAtOuter = */ false);
|
||||
RootedObject global(cx, UncheckedUnwrap(&globalArg.toObject(),
|
||||
/* stopAtOuter = */ false));
|
||||
NS_ENSURE_TRUE(JS_IsGlobalObject(global), NS_ERROR_INVALID_ARG);
|
||||
if (nsContentUtils::IsSystemPrincipal(GetObjectPrincipal(global))) {
|
||||
JS_ReportError(cx, "Script may not be disabled for system globals");
|
||||
|
Loading…
Reference in New Issue
Block a user