зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1052139 - Continued work on making the global object's prototype chain immutable, once a switch is flipped. r=bz
--HG-- extra : rebase_source : ca97d872091b35bb3b729f971f8cbfed404fd7bc
This commit is contained in:
Родитель
41ad01b9a5
Коммит
a83ec4837b
|
@ -1040,6 +1040,12 @@ xpc::CreateSandboxObject(JSContext* cx, MutableHandleValue vp, nsISupports* prin
|
|||
{
|
||||
JSAutoCompartment ac(cx, sandbox);
|
||||
|
||||
nsCOMPtr<nsIScriptObjectPrincipal> sbp =
|
||||
new SandboxPrivate(principal, sandbox);
|
||||
|
||||
// Pass on ownership of sbp to |sandbox|.
|
||||
JS_SetPrivate(sandbox, sbp.forget().take());
|
||||
|
||||
if (options.proto) {
|
||||
bool ok = JS_WrapObject(cx, &options.proto);
|
||||
if (!ok)
|
||||
|
@ -1074,17 +1080,11 @@ xpc::CreateSandboxObject(JSContext* cx, MutableHandleValue vp, nsISupports* prin
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
ok = JS_SetPrototype(cx, sandbox, options.proto);
|
||||
ok = JS_SplicePrototype(cx, sandbox, options.proto);
|
||||
if (!ok)
|
||||
return NS_ERROR_XPC_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptObjectPrincipal> sbp =
|
||||
new SandboxPrivate(principal, sandbox);
|
||||
|
||||
// Pass on ownership of sbp to |sandbox|.
|
||||
JS_SetPrivate(sandbox, sbp.forget().take());
|
||||
|
||||
// Don't try to mirror the properties that are set below.
|
||||
AutoSkipPropertyMirroring askip(CompartmentPrivate::Get(sandbox));
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче