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

Unified Diff: src/v8natives.js

Issue 6695018: Follow Safari on not throwing when __defineGetter__ fails.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 9 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-1240.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
===================================================================
--- src/v8natives.js (revision 7175)
+++ src/v8natives.js (working copy)
@@ -255,7 +255,7 @@
desc.setGet(fun);
desc.setEnumerable(true);
desc.setConfigurable(true);
- DefineOwnProperty(ToObject(this), ToString(name), desc, true);
+ DefineOwnProperty(ToObject(this), ToString(name), desc, false);
}
@@ -279,7 +279,7 @@
desc.setSet(fun);
desc.setEnumerable(true);
desc.setConfigurable(true);
- DefineOwnProperty(ToObject(this), ToString(name), desc, true);
+ DefineOwnProperty(ToObject(this), ToString(name), desc, false);
}
@@ -573,8 +573,13 @@
// Error handling according to spec.
// Step 3
- if (IS_UNDEFINED(current) && !extensible)
- throw MakeTypeError("define_disallowed", ["defineProperty"]);
+ if (IS_UNDEFINED(current) && !extensible) {
+ if (should_throw) {
+ throw MakeTypeError("define_disallowed", ["defineProperty"]);
+ } else {
+ return;
+ }
+ }
if (!IS_UNDEFINED(current)) {
// Step 5 and 6
@@ -599,31 +604,55 @@
if (desc.isConfigurable() ||
(desc.hasEnumerable() &&
desc.isEnumerable() != current.isEnumerable())) {
- throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
+ if (should_throw) {
+ throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
+ } else {
+ return;
+ }
}
// Step 8
if (!IsGenericDescriptor(desc)) {
// Step 9a
if (IsDataDescriptor(current) != IsDataDescriptor(desc)) {
- throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
+ if (should_throw) {
+ throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
+ } else {
+ return;
+ }
}
// Step 10a
if (IsDataDescriptor(current) && IsDataDescriptor(desc)) {
if (!current.isWritable() && desc.isWritable()) {
- throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
+ if (should_throw) {
+ throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
+ } else {
+ return;
+ }
}
if (!current.isWritable() && desc.hasValue() &&
!SameValue(desc.getValue(), current.getValue())) {
- throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
+ if (should_throw) {
+ throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
+ } else {
+ return;
+ }
}
}
// Step 11
if (IsAccessorDescriptor(desc) && IsAccessorDescriptor(current)) {
if (desc.hasSetter() && !SameValue(desc.getSet(), current.getSet())) {
- throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
+ if (should_throw) {
+ throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
+ } else {
+ return;
+ }
}
if (desc.hasGetter() && !SameValue(desc.getGet(),current.getGet())) {
- throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
+ if (should_throw) {
+ throw MakeTypeError("redefine_disallowed", ["defineProperty"]);
+ } else {
+ return;
+ }
}
}
}
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-1240.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698