Access checks test for stores to 'super'.

R=dcarney@chromium.org
BUG=v8:3330
LOG=N

Review URL: https://codereview.chromium.org/609273002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24273 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
dslomov@chromium.org 2014-09-29 08:47:04 +00:00
parent 287bb3b33b
commit 6312804eb3

View File

@ -9656,12 +9656,36 @@ TEST(SuperAccessControl) {
LocalContext env; LocalContext env;
env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance()); env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance());
v8::TryCatch try_catch; {
CompileRun( v8::TryCatch try_catch;
"function f() { return super.hasOwnProperty; };" CompileRun(
"var m = f.toMethod(prohibited);" "function f() { return super.hasOwnProperty; };"
"m();"); "var m = f.toMethod(prohibited);"
CHECK(try_catch.HasCaught()); "m();");
CHECK(try_catch.HasCaught());
}
{
v8::TryCatch try_catch;
CompileRun(
"function f() { super.hasOwnProperty = function () {}; };"
"var m = f.toMethod(prohibited);"
"m();");
CHECK(try_catch.HasCaught());
}
{
v8::TryCatch try_catch;
CompileRun(
"Object.defineProperty(Object.prototype, 'x', { set : function(){}});"
"function f() { "
" 'use strict';"
" super.x = function () {}; "
"};"
"var m = f.toMethod(prohibited);"
"m();");
CHECK(try_catch.HasCaught());
}
} }