Changeset 246851 in webkit
- Timestamp:
- Jun 26, 2019 4:07:28 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r246780 r246851 1 2019-06-26 Keith Miller <keith_miller@apple.com> 2 3 speciesConstruct needs to throw if the result is a DataView 4 https://bugs.webkit.org/show_bug.cgi?id=199231 5 6 Reviewed by Mark Lam. 7 8 * stress/typedarray-filter.js: 9 (subclasses.forEach): 10 * stress/typedarray-map.js: 11 (subclasses.forEach): 12 * stress/typedarray-slice.js: 13 (typedArrays.forEach): 14 * stress/typedarray-subarray.js: 15 (subclasses.forEach): 16 1 17 2019-06-24 Commit Queue <commit-queue@webkit.org> 2 18 -
trunk/JSTests/stress/typedarray-filter.js
r196950 r246851 92 92 shouldBeTrue("forEachTypedArray(subclasses, testSpeciesIsDefault)"); 93 93 94 subclasses.forEach(function(constructor) { constructor[Symbol.species] = () => new DataView(new ArrayBuffer()); }); 95 function testSpeciesReturnsDataView(array, constructor) { 96 try { 97 array.filter(accept); 98 } catch (e) { 99 return e instanceof TypeError; 100 } 101 return false; 102 } 103 shouldBeTrue("forEachTypedArray(subclasses, testSpeciesReturnsDataView)"); 104 94 105 subclasses = typedArrays.map(function(constructor) { return class extends constructor { } } ); 95 106 function testSpeciesRemoveConstructor(array, constructor) { … … 101 112 102 113 shouldBeTrue("forEachTypedArray(subclasses, testSpeciesRemoveConstructor)"); 114 103 115 finishJSTest(); -
trunk/JSTests/stress/typedarray-map.js
r196950 r246851 91 91 shouldBeTrue("forEachTypedArray(subclasses, testSpeciesIsDefault)"); 92 92 93 subclasses.forEach(function(constructor) { constructor[Symbol.species] = () => new DataView(new ArrayBuffer()); }); 94 function testSpeciesReturnsDataView(array, constructor) { 95 try { 96 array.map(id); 97 } catch (e) { 98 return e instanceof TypeError; 99 } 100 return false; 101 } 102 shouldBeTrue("forEachTypedArray(subclasses, testSpeciesReturnsDataView)"); 103 93 104 subclasses = typedArrays.map(function(constructor) { return class extends constructor { } } ); 94 105 function testSpeciesRemoveConstructor(array, constructor) { -
trunk/JSTests/stress/typedarray-slice.js
r204868 r246851 170 170 shouldBeTrue("forEachTypedArray(typedArrays, testSpeciesWithTransferring)"); 171 171 172 typedArrays.forEach(function(constructor) { constructor[Symbol.species] = () => new DataView(new ArrayBuffer()); }); 173 function testSpeciesReturnsDataView(array, constructor) { 174 try { 175 array.slice(0, 1); 176 } catch (e) { 177 return e instanceof TypeError; 178 } 179 return false; 180 } 181 shouldBeTrue("forEachTypedArray(typedArrays, testSpeciesReturnsDataView)"); 182 172 183 finishJSTest(); -
trunk/JSTests/stress/typedarray-subarray.js
r203351 r246851 49 49 shouldBeTrue("forEachTypedArray(subclasses, testSpeciesIsDefault)"); 50 50 51 subclasses.forEach(function(constructor) { constructor[Symbol.species] = () => new DataView(new ArrayBuffer()); }); 52 function testSpeciesReturnsDataView(array, constructor) { 53 try { 54 array.subarray(0, 0); 55 } catch (e) { 56 return e instanceof TypeError; 57 } 58 return false; 59 } 60 shouldBeTrue("forEachTypedArray(subclasses, testSpeciesReturnsDataView)"); 61 51 62 subclasses = typedArrays.map(function(constructor) { return class extends constructor { } } ); 52 63 function testSpeciesRemoveConstructor(array, constructor) { -
trunk/Source/JavaScriptCore/ChangeLog
r246850 r246851 1 2019-06-26 Keith Miller <keith_miller@apple.com> 2 3 speciesConstruct needs to throw if the result is a DataView 4 https://bugs.webkit.org/show_bug.cgi?id=199231 5 6 Reviewed by Mark Lam. 7 8 Previously, we only checked that the result was a 9 JSArrayBufferView, which can include DataViews. This is incorrect 10 as the result should be only be a TypedArray. 11 12 * runtime/JSGenericTypedArrayViewPrototypeFunctions.h: 13 (JSC::speciesConstruct): 14 1 15 2019-06-26 Joseph Pecoraro <pecoraro@apple.com> 2 16 -
trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h
r243391 r246851 71 71 72 72 if (JSArrayBufferView* view = jsDynamicCast<JSArrayBufferView*>(vm, result)) { 73 if (view->type() == DataViewType) { 74 throwTypeError(exec, scope, "species constructor did not return a TypedArray View"_s); 75 return nullptr; 76 } 77 73 78 if (!view->isNeutered()) 74 79 return view;
Note: See TracChangeset
for help on using the changeset viewer.