Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2441)

Unified Diff: src/objects.cc

Issue 1378343002: Add access check to JSObject::IsExtensible. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index df526d5bd7ce23abeb2b085c9488172180f8511a..57a61c51e9d5578a633f57f866cb575e26600d08 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -4867,7 +4867,8 @@ Maybe<bool> JSObject::CreateDataProperty(LookupIterator* it,
if (it->IsFound()) {
if (!it->IsConfigurable()) return Just(false);
} else {
- if (!JSObject::cast(*it->GetReceiver())->IsExtensible()) return Just(false);
+ if (!JSObject::IsExtensible(Handle<JSObject>::cast(it->GetReceiver())))
+ return Just(false);
}
RETURN_ON_EXCEPTION_VALUE(
@@ -6016,14 +6017,18 @@ MaybeHandle<Object> JSObject::PreventExtensions(Handle<JSObject> object) {
}
-bool JSObject::IsExtensible() {
- if (IsJSGlobalProxy()) {
- PrototypeIterator iter(GetIsolate(), this);
+bool JSObject::IsExtensible(Handle<JSObject> object) {
+ Isolate* isolate = object->GetIsolate();
+ if (object->IsAccessCheckNeeded() && !isolate->MayAccess(object)) {
+ return true;
+ }
+ if (object->IsJSGlobalProxy()) {
+ PrototypeIterator iter(isolate, *object);
if (iter.IsAtEnd()) return false;
DCHECK(iter.GetCurrent()->IsJSGlobalObject());
return iter.GetCurrent<JSObject>()->map()->is_extensible();
}
- return map()->is_extensible();
+ return object->map()->is_extensible();
}
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698