Changeset 247811 in webkit
- Timestamp:
- Jul 24, 2019 7:09:42 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r247724 r247811 1 2019-07-24 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 Three checks are missing in Proxy internal methods 4 https://bugs.webkit.org/show_bug.cgi?id=198630 5 6 Reviewed by Darin Adler. 7 8 * stress/proxy-delete.js: Assert isExtensible is called in correct order. 9 * test262/expectations.yaml: Mark 6 test cases as passing. 10 1 11 2019-07-23 Justin Michaud <justin_michaud@apple.com> 2 12 -
trunk/JSTests/stress/proxy-delete.js
r198813 r247811 90 90 } 91 91 assert(threw); 92 } 93 } 94 95 { 96 let target = new Proxy({}, { 97 isExtensible: function() { 98 throw new Error("should not be called if [[GetOwnProperty]] returns undefined"); 99 } 100 }); 101 let proxy = new Proxy(target, { 102 deleteProperty: function() { 103 return true; 104 } 105 }); 106 for (let i = 0; i < 500; i++) { 107 assert(delete proxy.nonExistentProperty); 108 } 109 } 110 111 { 112 let calls; 113 let target = new Proxy({}, { 114 getOwnPropertyDescriptor: function() { 115 calls.push('getOwnPropertyDescriptor'); 116 return { configurable: true }; 117 }, 118 isExtensible: function() { 119 calls.push('isExtensible'); 120 return true; 121 } 122 }); 123 let proxy = new Proxy(target, { 124 deleteProperty: function() { 125 calls.push('trap'); 126 return true; 127 } 128 }); 129 for (let i = 0; i < 500; i++) { 130 calls = []; 131 assert(delete proxy.prop); 132 assert(calls.join() == 'trap,getOwnPropertyDescriptor,isExtensible'); 92 133 } 93 134 } -
trunk/JSTests/test262/expectations.yaml
r247485 r247811 1344 1344 strict mode: 'Test262Error: Expected a TypeError but got a TypeError' 1345 1345 test/built-ins/Proxy/create-handler-is-revoked-proxy.js: 1346 default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all'1347 strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all'1348 test/built-ins/Proxy/defineProperty/targetdesc-not-configurable-writable-desc-not-writable.js:1349 default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all'1350 strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all'1351 test/built-ins/Proxy/deleteProperty/targetdesc-is-configurable-target-is-not-extensible.js:1352 default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all'1353 strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all'1354 test/built-ins/Proxy/getOwnPropertyDescriptor/resultdesc-is-not-configurable-not-writable-targetdesc-is-writable.js:1355 1346 default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' 1356 1347 strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' -
trunk/Source/JavaScriptCore/ChangeLog
r247801 r247811 1 2019-07-24 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 Three checks are missing in Proxy internal methods 4 https://bugs.webkit.org/show_bug.cgi?id=198630 5 6 Reviewed by Darin Adler. 7 8 Add three missing checks in Proxy internal methods. 9 These checks are necessary to maintain the invariants of the essential internal methods. 10 (https://github.com/tc39/ecma262/pull/666) 11 12 1. [[GetOwnProperty]] shouldn't return non-configurable and non-writable descriptor when the target's property is writable. 13 2. [[Delete]] should return `false` when the target has property and is not extensible. 14 3. [[DefineOwnProperty]] should return `true` for a non-writable input descriptor when the target's property is non-configurable and writable. 15 16 Shipping in SpiderMonkey since https://hg.mozilla.org/integration/autoland/rev/3a06bc818bc4 (version 69) 17 Shipping in V8 since https://chromium.googlesource.com/v8/v8.git/+/e846ad9fa5109428be50b1989314e0e4e7267919 18 19 * runtime/ProxyObject.cpp: 20 (JSC::ProxyObject::performInternalMethodGetOwnProperty): Add writability check. 21 (JSC::ProxyObject::performDelete): Add extensibility check. 22 (JSC::ProxyObject::performDefineOwnProperty): Add writability check. 23 1 24 2019-07-24 Mark Lam <mark.lam@apple.com> 2 25 -
trunk/Source/JavaScriptCore/runtime/ProxyObject.cpp
r246346 r247811 288 288 return false; 289 289 } 290 if (trapResultAsDescriptor.writablePresent() && !trapResultAsDescriptor.writable() && targetPropertyDescriptor.writable()) { 291 throwVMTypeError(exec, scope, "Result from 'getOwnPropertyDescriptor' can't be non-configurable and non-writable when the target's property is writable"_s); 292 return false; 293 } 290 294 } 291 295 … … 663 667 return false; 664 668 } 669 bool targetIsExtensible = target->isExtensible(exec); 670 RETURN_IF_EXCEPTION(scope, false); 671 if (!targetIsExtensible) { 672 throwVMTypeError(exec, scope, "Proxy handler's 'deleteProperty' method should return false when the target has property and is not extensible"_s); 673 return false; 674 } 665 675 } 666 676 … … 886 896 throwVMTypeError(exec, scope, "Proxy's 'defineProperty' trap did not define a non-configurable property on its target even though the input descriptor to the trap said it must do so"_s); 887 897 return false; 898 } 899 if (targetDescriptor.isDataDescriptor() && !targetDescriptor.configurable() && targetDescriptor.writable()) { 900 if (descriptor.writablePresent() && !descriptor.writable()) { 901 throwTypeError(exec, scope, "Proxy's 'defineProperty' trap returned true for a non-writable input descriptor when the target's property is non-configurable and writable"_s); 902 return false; 903 } 888 904 } 889 905
Note: See TracChangeset
for help on using the changeset viewer.