Commit e5fcd33b authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[ic] do not expose global object

Bug: chromium:913212
Change-Id: I6bc4bb313d17840cc778d9d8c2eb3c6f2cc024a1
Reviewed-on: https://chromium-review.googlesource.com/c/1371605Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58162}
parent 5c779700
......@@ -1052,9 +1052,16 @@ MaybeHandle<Object> Object::GetProperty(LookupIterator* it,
UNREACHABLE();
case LookupIterator::JSPROXY: {
bool was_found;
Handle<Object> receiver = it->GetReceiver();
// In case of global IC, the receiver is the global object. Replace by
// the global proxy.
if (receiver->IsJSGlobalObject()) {
receiver = handle(JSGlobalObject::cast(*receiver)->global_proxy(),
it->isolate());
}
MaybeHandle<Object> result =
JSProxy::GetProperty(it->isolate(), it->GetHolder<JSProxy>(),
it->GetName(), it->GetReceiver(), &was_found);
it->GetName(), receiver, &was_found);
if (!was_found) it->NotFound();
return result;
}
......@@ -5197,9 +5204,17 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
return JSObject::SetPropertyWithFailedAccessCheck(it, value,
should_throw);
case LookupIterator::JSPROXY:
case LookupIterator::JSPROXY: {
Handle<Object> receiver = it->GetReceiver();
// In case of global IC, the receiver is the global object. Replace by
// the global proxy.
if (receiver->IsJSGlobalObject()) {
receiver = handle(JSGlobalObject::cast(*receiver)->global_proxy(),
it->isolate());
}
return JSProxy::SetProperty(it->GetHolder<JSProxy>(), it->GetName(),
value, it->GetReceiver(), language_mode);
value, receiver, language_mode);
}
case LookupIterator::INTERCEPTOR: {
if (it->HolderIsReceiverOrHiddenPrototype()) {
......
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
const globalThis = this;
Object.setPrototypeOf(this, new Proxy({}, {
get(target, prop, receiver) {
assertTrue(receiver === globalThis);
}
}));
undefined_name_access
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