| 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;
|
| + }
|
| }
|
| }
|
| }
|
|
|