mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1151385 - Fail early for cross-origin sandboxPrototype. r=gabor
This commit is contained in:
parent
196450c61a
commit
d46439b4b9
@ -945,7 +945,11 @@ xpc::CreateSandboxObject(JSContext* cx, MutableHandleValue vp, nsISupports* prin
|
||||
return NS_ERROR_XPC_UNEXPECTED;
|
||||
|
||||
// Now check what sort of thing we've got in |proto|
|
||||
JSObject* unwrappedProto = js::UncheckedUnwrap(options.proto, false);
|
||||
JSObject* unwrappedProto = js::CheckedUnwrap(options.proto, false);
|
||||
if (!unwrappedProto) {
|
||||
JS_ReportError(cx, "Sandbox must subsume sandboxPrototype");
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
const js::Class* unwrappedClass = js::GetObjectClass(unwrappedProto);
|
||||
if (IS_WN_CLASS(unwrappedClass) ||
|
||||
mozilla::dom::IsDOMClass(Jsvalify(unwrappedClass))) {
|
||||
|
9
js/xpconnect/tests/unit/test_bug1151385.js
Normal file
9
js/xpconnect/tests/unit/test_bug1151385.js
Normal file
@ -0,0 +1,9 @@
|
||||
function run_test()
|
||||
{
|
||||
try {
|
||||
var sandbox = new Components.utils.Sandbox(null, {"sandboxPrototype" : {}});
|
||||
do_check_true(false);
|
||||
} catch (e) {
|
||||
do_check_true(/must subsume sandboxPrototype/.test(e));
|
||||
}
|
||||
}
|
@ -55,6 +55,7 @@ support-files =
|
||||
[test_bug1081990.js]
|
||||
[test_bug1110546.js]
|
||||
[test_bug1150771.js]
|
||||
[test_bug1151385.js]
|
||||
[test_bug_442086.js]
|
||||
[test_callFunctionWithAsyncStack.js]
|
||||
[test_file.js]
|
||||
|
Loading…
Reference in New Issue
Block a user