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

Unified Diff: src/objects.cc

Issue 1422973002: Fix access check in JSObject::PreventExtensions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add a test. Created 5 years, 2 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 | « no previous file | test/cctest/test-api.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 433dda7d6f98daa1aac991c04413c4d3d4501bc8..a979f3ed8242deb7dd499acde4474fa67eff1abd 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -6771,8 +6771,6 @@ Maybe<bool> JSObject::PreventExtensions(Handle<JSObject> object,
ShouldThrow should_throw) {
Isolate* isolate = object->GetIsolate();
- if (!object->map()->is_extensible()) return Just(true);
-
if (!object->HasSloppyArgumentsElements() && !object->map()->is_observed()) {
return PreventExtensionsWithTransition<NONE>(object, should_throw);
}
@@ -6786,6 +6784,8 @@ Maybe<bool> JSObject::PreventExtensions(Handle<JSObject> object,
NewTypeError(MessageTemplate::kNoAccess));
}
+ if (!object->map()->is_extensible()) return Just(true);
+
if (object->IsJSGlobalProxy()) {
PrototypeIterator iter(isolate, object);
if (iter.IsAtEnd()) return Just(true);
@@ -6887,6 +6887,8 @@ Maybe<bool> JSObject::PreventExtensionsWithTransition(
NewTypeError(MessageTemplate::kNoAccess));
}
+ if (attrs == NONE && !object->map()->is_extensible()) return Just(true);
+
if (object->IsJSGlobalProxy()) {
PrototypeIterator iter(isolate, object);
if (iter.IsAtEnd()) return Just(true);
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698