Changeset 181868 in webkit
- Timestamp:
- Mar 23, 2015, 1:48:21 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/js/property-getters-and-setters-expected.txt (modified) (1 diff)
-
LayoutTests/js/script-tests/property-getters-and-setters.js (modified) (1 diff)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/runtime/ObjectPrototype.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r181864 r181868 1 2015-03-23 Joseph Pecoraro <pecoraro@apple.com> 2 3 __defineGetter__/__defineSetter__ should throw exceptions 4 https://bugs.webkit.org/show_bug.cgi?id=142934 5 6 Reviewed by Geoffrey Garen. 7 8 * js/property-getters-and-setters-expected.txt: 9 * js/script-tests/property-getters-and-setters.js: 10 1 11 2015-03-23 Anders Carlsson <andersca@apple.com> 2 12 -
trunk/LayoutTests/js/property-getters-and-setters-expected.txt
r165680 r181868 44 44 PASS o13.__lookupGetter__('b') is void 0 45 45 PASS o13.__lookupSetter__('b') is void 0 46 __defineGetter__ and __defineSetter__ should throw exceptions when acting on sealed objects 47 PASS o14.__defineGetter__('a', function(){}) threw exception TypeError: Attempting to configurable attribute of unconfigurable property.. 48 PASS o14.__defineGetter__('b', function(){}) threw exception TypeError: Attempting to define property on object that is not extensible.. 49 PASS o14.__defineSetter__('a', function(){}) threw exception TypeError: Attempting to configurable attribute of unconfigurable property.. 50 PASS o14.__defineSetter__('b', function(){}) threw exception TypeError: Attempting to define property on object that is not extensible.. 51 __defineGetter__ and __defineSetter__ should throw exceptions when acting on frozen objects 52 PASS o15.__defineGetter__('a', function(){}) threw exception TypeError: Attempting to configurable attribute of unconfigurable property.. 53 PASS o15.__defineGetter__('b', function(){}) threw exception TypeError: Attempting to define property on object that is not extensible.. 54 PASS o15.__defineSetter__('a', function(){}) threw exception TypeError: Attempting to configurable attribute of unconfigurable property.. 55 PASS o15.__defineSetter__('b', function(){}) threw exception TypeError: Attempting to define property on object that is not extensible.. 56 __defineGetter__ and __defineSetter__ should throw exceptions when acting on unconfigurable properties 57 PASS o16.__defineGetter__('a', function(){}) did not throw exception. 58 PASS o16.__defineSetter__('a', function(){}) did not throw exception. 59 PASS o16.__defineSetter__('b', function(){}) threw exception TypeError: Attempting to configurable attribute of unconfigurable property.. 60 PASS o16.__defineSetter__('b', function(){}) threw exception TypeError: Attempting to configurable attribute of unconfigurable property.. 46 61 PASS successfullyParsed is true 47 62 -
trunk/LayoutTests/js/script-tests/property-getters-and-setters.js
r165680 r181868 100 100 shouldBe("o13.__lookupGetter__('b')", "void 0"); 101 101 shouldBe("o13.__lookupSetter__('b')", "void 0"); 102 103 debug("__defineGetter__ and __defineSetter__ should throw exceptions when acting on sealed objects"); 104 var o14 = {a:14}; 105 Object.seal(o14); 106 shouldThrow("o14.__defineGetter__('a', function(){})"); 107 shouldThrow("o14.__defineGetter__('b', function(){})"); 108 shouldThrow("o14.__defineSetter__('a', function(){})"); 109 shouldThrow("o14.__defineSetter__('b', function(){})"); 110 111 debug("__defineGetter__ and __defineSetter__ should throw exceptions when acting on frozen objects"); 112 var o15 = {a:15}; 113 Object.freeze(o15); 114 shouldThrow("o15.__defineGetter__('a', function(){})"); 115 shouldThrow("o15.__defineGetter__('b', function(){})"); 116 shouldThrow("o15.__defineSetter__('a', function(){})"); 117 shouldThrow("o15.__defineSetter__('b', function(){})"); 118 119 debug("__defineGetter__ and __defineSetter__ should throw exceptions when acting on unconfigurable properties"); 120 var o16 = {a:16}; 121 Object.defineProperty(o16, "b", {value: 16, configurable: false}); 122 shouldNotThrow("o16.__defineGetter__('a', function(){})"); 123 shouldNotThrow("o16.__defineSetter__('a', function(){})"); 124 shouldThrow("o16.__defineSetter__('b', function(){})"); 125 shouldThrow("o16.__defineSetter__('b', function(){})"); -
trunk/Source/JavaScriptCore/ChangeLog
r181867 r181868 1 2015-03-23 Joseph Pecoraro <pecoraro@apple.com> 2 3 __defineGetter__/__defineSetter__ should throw exceptions 4 https://bugs.webkit.org/show_bug.cgi?id=142934 5 6 Reviewed by Geoffrey Garen. 7 8 * runtime/ObjectPrototype.cpp: 9 (JSC::objectProtoFuncDefineGetter): 10 (JSC::objectProtoFuncDefineSetter): 11 Throw exceptions when these functions are used directly. 12 1 13 2015-03-23 Joseph Pecoraro <pecoraro@apple.com> 2 14 -
trunk/Source/JavaScriptCore/runtime/ObjectPrototype.cpp
r181814 r181868 123 123 descriptor.setEnumerable(true); 124 124 descriptor.setConfigurable(true); 125 thisObject->methodTable(exec->vm())->defineOwnProperty(thisObject, exec, exec->argument(0).toPropertyKey(exec), descriptor, false); 125 126 bool shouldThrow = true; 127 thisObject->methodTable(exec->vm())->defineOwnProperty(thisObject, exec, exec->argument(0).toPropertyKey(exec), descriptor, shouldThrow); 126 128 127 129 return JSValue::encode(jsUndefined()); … … 143 145 descriptor.setEnumerable(true); 144 146 descriptor.setConfigurable(true); 145 thisObject->methodTable(exec->vm())->defineOwnProperty(thisObject, exec, exec->argument(0).toPropertyKey(exec), descriptor, false); 147 148 bool shouldThrow = true; 149 thisObject->methodTable(exec->vm())->defineOwnProperty(thisObject, exec, exec->argument(0).toPropertyKey(exec), descriptor, shouldThrow); 146 150 147 151 return JSValue::encode(jsUndefined());
Note:
See TracChangeset
for help on using the changeset viewer.