Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 5003b4f8c30b76d10c0bfeb29b3ed7c0c9736ce8..8f70c724fea103a87d8c5eddd87b9ccb5ddac13f 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -1399,7 +1399,7 @@ MaybeObject* JSObject::AddProperty(String* name, |
if (!map()->is_extensible()) { |
Handle<Object> args[1] = {Handle<String>(name)}; |
return Top::Throw(*Factory::NewTypeError("object_not_extensible", |
- HandleVector(args, 1))); |
+ HandleVector(args, 1))); |
} |
if (HasFastProperties()) { |
// Ensure the descriptor array does not get too big. |
@@ -2620,7 +2620,14 @@ MaybeObject* JSObject::DeleteElement(uint32_t index, DeleteMode mode) { |
NumberDictionary* dictionary = element_dictionary(); |
int entry = dictionary->FindEntry(index); |
if (entry != NumberDictionary::kNotFound) { |
- return dictionary->DeleteProperty(entry, mode); |
+ Object* result = dictionary->DeleteProperty(entry, mode); |
Martin Maly
2011/02/14 05:15:22
DeleteProperty is a wrong place to report the erro
Mads Ager (chromium)
2011/02/14 10:27:24
I think that makes sense. Could you add a comment
Martin Maly
2011/02/14 21:46:51
Done.
|
+ if (mode == STRICT_DELETION && result == Heap::false_value()) { |
+ HandleScope scope; |
+ Handle<Object> i = Factory::NewNumberFromUint(index); |
+ Handle<Object> args[2] = { i, Handle<Object>(this) }; |
+ return Top::Throw(*Factory::NewTypeError("strict_delete_property", |
+ HandleVector(args, 2))); |
+ } |
} |
break; |
} |
@@ -2659,6 +2666,12 @@ MaybeObject* JSObject::DeleteProperty(String* name, DeleteMode mode) { |
if (!result.IsProperty()) return Heap::true_value(); |
// Ignore attributes if forcing a deletion. |
if (result.IsDontDelete() && mode != FORCE_DELETION) { |
+ if (mode == STRICT_DELETION) { |
+ HandleScope scope; |
+ Handle<Object> args[2] = { Handle<Object>(name), Handle<Object>(this) }; |
+ return Top::Throw(*Factory::NewTypeError("strict_delete_property", |
+ HandleVector(args, 2))); |
+ } |
return Heap::false_value(); |
} |
// Check for interceptor. |
@@ -9345,7 +9358,7 @@ Object* Dictionary<Shape, Key>::DeleteProperty(int entry, |
JSObject::DeleteMode mode) { |
PropertyDetails details = DetailsAt(entry); |
// Ignore attributes if forcing a deletion. |
- if (details.IsDontDelete() && mode == JSObject::NORMAL_DELETION) { |
+ if (details.IsDontDelete() && mode != JSObject::FORCE_DELETION) { |
return Heap::false_value(); |
} |
SetEntry(entry, Heap::null_value(), Heap::null_value(), Smi::FromInt(0)); |