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

Unified Diff: src/accessors.cc

Issue 411983003: Fix ArrayLengthSetter to not throw on non-extensible receivers. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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/mjsunit/regress/regress-mask-array-length.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/accessors.cc
diff --git a/src/accessors.cc b/src/accessors.cc
index cc7c22e223b52bce6a06c7dfc4a6c8001c5a7e63..702343778ae756a2a92f5ce19363f9d13581f242 100644
--- a/src/accessors.cc
+++ b/src/accessors.cc
@@ -174,13 +174,16 @@ void Accessors::ArrayLengthSetter(
const v8::PropertyCallbackInfo<void>& info) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
HandleScope scope(isolate);
- Handle<JSObject> object = Handle<JSObject>::cast(
- Utils::OpenHandle(*info.This()));
+ Handle<JSObject> object = Utils::OpenHandle(*info.This());
Handle<Object> value = Utils::OpenHandle(*val);
// This means one of the object's prototypes is a JSArray and the
// object does not have a 'length' property. Calling SetProperty
// causes an infinite loop.
if (!object->IsJSArray()) {
+ // This behaves sloppy since we lost the actual strict-mode.
+ // TODO(verwaest): Fix by making ExecutableAccessorInfo behave like data
+ // properties.
+ if (!object->map()->is_extensible()) return;
MaybeHandle<Object> maybe_result = JSObject::SetOwnPropertyIgnoreAttributes(
object, isolate->factory()->length_string(), value, NONE);
maybe_result.Check();
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-mask-array-length.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698