Commit dc71c1b5 authored by verwaest's avatar verwaest Committed by Commit bot

Fix getPrototypeOf for access checked objects

BUG=chromium:509936
LOG=y

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

Cr-Commit-Position: refs/heads/master@{#29721}
parent ac1c7136
...@@ -193,10 +193,7 @@ MaybeHandle<Object> Runtime::GetPrototype(Isolate* isolate, ...@@ -193,10 +193,7 @@ MaybeHandle<Object> Runtime::GetPrototype(Isolate* isolate,
if (PrototypeIterator::GetCurrent(iter)->IsAccessCheckNeeded() && if (PrototypeIterator::GetCurrent(iter)->IsAccessCheckNeeded() &&
!isolate->MayAccess( !isolate->MayAccess(
Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)))) { Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)))) {
isolate->ReportFailedAccessCheck( return isolate->factory()->null_value();
Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)));
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
return isolate->factory()->undefined_value();
} }
iter.AdvanceIgnoringProxies(); iter.AdvanceIgnoringProxies();
if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) {
......
...@@ -18104,20 +18104,20 @@ THREADED_TEST(Regress93759) { ...@@ -18104,20 +18104,20 @@ THREADED_TEST(Regress93759) {
CHECK(result1->Equals(simple_object->GetPrototype())); CHECK(result1->Equals(simple_object->GetPrototype()));
Local<Value> result2 = CompileRun("Object.getPrototypeOf(protected)"); Local<Value> result2 = CompileRun("Object.getPrototypeOf(protected)");
CHECK(result2.IsEmpty()); CHECK(result2->IsNull());
Local<Value> result3 = CompileRun("Object.getPrototypeOf(global)"); Local<Value> result3 = CompileRun("Object.getPrototypeOf(global)");
CHECK(result3->Equals(global_object->GetPrototype())); CHECK(result3->Equals(global_object->GetPrototype()));
Local<Value> result4 = CompileRun("Object.getPrototypeOf(proxy)"); Local<Value> result4 = CompileRun("Object.getPrototypeOf(proxy)");
CHECK(result4.IsEmpty()); CHECK(result4->IsNull());
Local<Value> result5 = CompileRun("Object.getPrototypeOf(hidden)"); Local<Value> result5 = CompileRun("Object.getPrototypeOf(hidden)");
CHECK(result5->Equals( CHECK(result5->Equals(
object_with_hidden->GetPrototype()->ToObject(isolate)->GetPrototype())); object_with_hidden->GetPrototype()->ToObject(isolate)->GetPrototype()));
Local<Value> result6 = CompileRun("Object.getPrototypeOf(phidden)"); Local<Value> result6 = CompileRun("Object.getPrototypeOf(phidden)");
CHECK(result6.IsEmpty()); CHECK(result6->IsNull());
} }
...@@ -21285,14 +21285,10 @@ TEST(GetPrototypeAccessControl) { ...@@ -21285,14 +21285,10 @@ TEST(GetPrototypeAccessControl) {
env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance()); env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance());
{ CHECK(CompileRun(
v8::TryCatch try_catch(isolate); "function f() { return %_GetPrototype(prohibited); }"
CompileRun( "%OptimizeFunctionOnNextCall(f);"
"function f() { %_GetPrototype(prohibited); }" "f();")->IsNull());
"%OptimizeFunctionOnNextCall(f);"
"f();");
CHECK(try_catch.HasCaught());
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment