Changeset 203393 in webkit
- Timestamp:
- Jul 18, 2016, 7:45:35 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r203391 r203393 1 2016-07-18 Joseph Pecoraro <pecoraro@apple.com> 2 3 Make builtin TypeErrors consistent 4 https://bugs.webkit.org/show_bug.cgi?id=159899 5 6 Reviewed by Keith Miller. 7 8 * js/array-find-expected.txt: 9 * js/array-findIndex-expected.txt: 10 * js/array-includes-expected.txt: 11 * js/dom/array-prototype-properties-expected.txt: 12 * js/dom/script-tests/string-prototype-properties.js: 13 * js/dom/string-prototype-properties-expected.txt: 14 * js/script-tests/array-find.js: 15 * js/script-tests/array-findIndex.js: 16 * js/script-tests/string-localeCompare.js: 17 * js/string-localeCompare-expected.txt: 18 * sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.10_String.prototype.match/S15.5.4.10_A1_T3-expected.txt: 19 * sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.11_String.prototype.replace/S15.5.4.11_A1_T3-expected.txt: 20 * sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.12_String.prototype.search/S15.5.4.12_A1_T3-expected.txt: 21 * sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.14_String.prototype.split/S15.5.4.14_A1_T3-expected.txt: 22 1 23 2016-07-18 Chris Dumez <cdumez@apple.com> 2 24 -
trunk/LayoutTests/js/array-find-expected.txt
r184848 r203393 43 43 PASS [0,1,2,3,4,5,6,7,8,9].find(findItemRemovedDuringSearch) is undefined 44 44 Exceptions 45 PASS Array.prototype.find.call(undefined, function() {}) threw exception TypeError: Array.prototype.find requires that |this| not be undefined.46 PASS Array.prototype.find.call(null, function() {}) threw exception TypeError: Array.prototype.find requires that |this| not be null .45 PASS Array.prototype.find.call(undefined, function() {}) threw exception TypeError: Array.prototype.find requires that |this| not be null or undefined. 46 PASS Array.prototype.find.call(null, function() {}) threw exception TypeError: Array.prototype.find requires that |this| not be null or undefined. 47 47 PASS [].find(1) threw exception TypeError: Array.prototype.find callback must be a function. 48 48 PASS [].find('hello') threw exception TypeError: Array.prototype.find callback must be a function. -
trunk/LayoutTests/js/array-findIndex-expected.txt
r184848 r203393 44 44 PASS [0,1,2,3,4,5,6,7,8,9].findIndex(findItemRemovedDuringSearch) is -1 45 45 Exceptions 46 PASS Array.prototype.findIndex.call(undefined, function() {}) threw exception TypeError: Array.prototype.findIndex requires that |this| not be undefined.47 PASS Array.prototype.findIndex.call(null, function() {}) threw exception TypeError: Array.prototype.findIndex requires that |this| not be null .46 PASS Array.prototype.findIndex.call(undefined, function() {}) threw exception TypeError: Array.prototype.findIndex requires that |this| not be null or undefined. 47 PASS Array.prototype.findIndex.call(null, function() {}) threw exception TypeError: Array.prototype.findIndex requires that |this| not be null or undefined. 48 48 PASS [].findIndex(1) threw exception TypeError: Array.prototype.findIndex callback must be a function. 49 49 PASS [].findIndex('hello') threw exception TypeError: Array.prototype.findIndex callback must be a function. -
trunk/LayoutTests/js/array-includes-expected.txt
r202926 r203393 29 29 PASS a.includes('hashbrown') is false 30 30 PASS a.includes('toast') is false 31 PASS Array.prototype.includes.call(undefined, 1) threw exception TypeError: Array.prototype.includes requires that |this| not be undefined.32 PASS Array.prototype.includes.call(null, 1) threw exception TypeError: Array.prototype.includes requires that |this| not be null .31 PASS Array.prototype.includes.call(undefined, 1) threw exception TypeError: Array.prototype.includes requires that |this| not be null or undefined. 32 PASS Array.prototype.includes.call(null, 1) threw exception TypeError: Array.prototype.includes requires that |this| not be null or undefined. 33 33 Array-like object with invalid lengths 34 34 PASS var obj = { 0: 1, 1: 1, 2: 1, length: 0 }; Array.prototype.includes.call(obj, 1) is false -
trunk/LayoutTests/js/dom/array-prototype-properties-expected.txt
r202125 r203393 6 6 PASS Array.prototype.toString.call(undefined) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.toString.call(undefined)'). 7 7 PASS Array.prototype.toLocaleString.call(undefined) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.toLocaleString.call(undefined)'). 8 PASS Array.prototype.concat.call(undefined, []) threw exception TypeError: Array.prototype.concat requires that |this| not be undefined.8 PASS Array.prototype.concat.call(undefined, []) threw exception TypeError: Array.prototype.concat requires that |this| not be null or undefined. 9 9 PASS Array.prototype.join.call(undefined, []) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.join.call(undefined, [])'). 10 10 PASS Array.prototype.pop.call(undefined) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.pop.call(undefined)'). … … 13 13 PASS Array.prototype.shift.call(undefined) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.shift.call(undefined)'). 14 14 PASS Array.prototype.slice.call(undefined, 0, 1) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.slice.call(undefined, 0, 1)'). 15 PASS Array.prototype.sort.call(undefined) threw exception TypeError: Array.prototype.sort requires that |this| not be undefined.15 PASS Array.prototype.sort.call(undefined) threw exception TypeError: Array.prototype.sort requires that |this| not be null or undefined. 16 16 PASS Array.prototype.splice.call(undefined, 0, 1) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.splice.call(undefined, 0, 1)'). 17 17 PASS Array.prototype.unshift.call(undefined, {}) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.unshift.call(undefined, {})'). 18 PASS Array.prototype.every.call(undefined, toString) threw exception TypeError: Array.prototype.every requires that |this| not be undefined.19 PASS Array.prototype.forEach.call(undefined, toString) threw exception TypeError: Array.prototype.forEach requires that |this| not be undefined.20 PASS Array.prototype.some.call(undefined, toString) threw exception TypeError: Array.prototype.some requires that |this| not be undefined.18 PASS Array.prototype.every.call(undefined, toString) threw exception TypeError: Array.prototype.every requires that |this| not be null or undefined. 19 PASS Array.prototype.forEach.call(undefined, toString) threw exception TypeError: Array.prototype.forEach requires that |this| not be null or undefined. 20 PASS Array.prototype.some.call(undefined, toString) threw exception TypeError: Array.prototype.some requires that |this| not be null or undefined. 21 21 PASS Array.prototype.indexOf.call(undefined, 0) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.indexOf.call(undefined, 0)'). 22 22 PASS Array.prototype.lastIndexOf.call(undefined, 0) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.lastIndexOf.call(undefined, 0)'). 23 PASS Array.prototype.filter.call(undefined, toString) threw exception TypeError: Array.prototype.filter requires that |this| not be undefined.24 PASS Array.prototype.reduce.call(undefined, toString) threw exception TypeError: Array.prototype.reduce requires that |this| not be undefined.25 PASS Array.prototype.reduceRight.call(undefined, toString) threw exception TypeError: Array.prototype.reduceRight requires that |this| not be undefined.26 PASS Array.prototype.map.call(undefined, toString) threw exception TypeError: Array.prototype.map requires that |this| not be undefined.23 PASS Array.prototype.filter.call(undefined, toString) threw exception TypeError: Array.prototype.filter requires that |this| not be null or undefined. 24 PASS Array.prototype.reduce.call(undefined, toString) threw exception TypeError: Array.prototype.reduce requires that |this| not be null or undefined. 25 PASS Array.prototype.reduceRight.call(undefined, toString) threw exception TypeError: Array.prototype.reduceRight requires that |this| not be null or undefined. 26 PASS Array.prototype.map.call(undefined, toString) threw exception TypeError: Array.prototype.map requires that |this| not be null or undefined. 27 27 PASS [{toLocaleString:function(){throw 1}},{toLocaleString:function(){throw 2}}].toLocaleString() threw exception 1. 28 28 PASS successfullyParsed is true -
trunk/LayoutTests/js/dom/script-tests/string-prototype-properties.js
r199967 r203393 21 21 shouldThrow("String.prototype.toLowerCase.call(undefined)"); 22 22 shouldThrow("String.prototype.toUpperCase.call(undefined)"); 23 shouldThrow("String.prototype.localeCompare.call(undefined, '1224')", "'TypeError: String.prototype.localeCompare requires that |this| not be undefined'");23 shouldThrow("String.prototype.localeCompare.call(undefined, '1224')", "'TypeError: String.prototype.localeCompare requires that |this| not be null or undefined'"); 24 24 shouldThrow("String.prototype.toLocaleLowerCase.call(undefined)"); 25 25 shouldThrow("String.prototype.toLocaleUpperCase.call(undefined)"); -
trunk/LayoutTests/js/dom/string-prototype-properties-expected.txt
r200117 r203393 11 11 PASS String.prototype.indexOf.call(undefined, '2') threw exception TypeError: Type error. 12 12 PASS String.prototype.lastIndexOf.call(undefined, '2') threw exception TypeError: Type error. 13 PASS String.prototype.match.call(undefined, /2+/) threw exception TypeError: String.prototype.match requires that |this| not be undefined.14 PASS String.prototype.replace.call(undefined, /2+/, '-') threw exception TypeError: String.prototype.replace requires that |this| not be undefined.15 PASS String.prototype.search.call(undefined, '4') threw exception TypeError: String.prototype.search requires that |this| not be undefined.13 PASS String.prototype.match.call(undefined, /2+/) threw exception TypeError: String.prototype.match requires that |this| not be null or undefined. 14 PASS String.prototype.replace.call(undefined, /2+/, '-') threw exception TypeError: String.prototype.replace requires that |this| not be null or undefined. 15 PASS String.prototype.search.call(undefined, '4') threw exception TypeError: String.prototype.search requires that |this| not be null or undefined. 16 16 PASS String.prototype.slice.call(undefined, 1, 3) threw exception TypeError: Type error. 17 PASS String.prototype.split.call(undefined, '2') threw exception TypeError: String.prototype.split requires that |this| not be undefined.17 PASS String.prototype.split.call(undefined, '2') threw exception TypeError: String.prototype.split requires that |this| not be null or undefined. 18 18 PASS String.prototype.slice.call(undefined, 1, 3) threw exception TypeError: Type error. 19 19 PASS String.prototype.substr.call(undefined, 1, 3) threw exception TypeError: Type error. … … 21 21 PASS String.prototype.toLowerCase.call(undefined) threw exception TypeError: Type error. 22 22 PASS String.prototype.toUpperCase.call(undefined) threw exception TypeError: Type error. 23 PASS String.prototype.localeCompare.call(undefined, '1224') threw exception TypeError: String.prototype.localeCompare requires that |this| not be undefined.23 PASS String.prototype.localeCompare.call(undefined, '1224') threw exception TypeError: String.prototype.localeCompare requires that |this| not be null or undefined. 24 24 PASS String.prototype.toLocaleLowerCase.call(undefined) threw exception TypeError: Type error. 25 25 PASS String.prototype.toLocaleUpperCase.call(undefined) threw exception TypeError: Type error. -
trunk/LayoutTests/js/script-tests/array-find.js
r184848 r203393 102 102 103 103 debug("Exceptions"); 104 shouldThrow("Array.prototype.find.call(undefined, function() {})", "'TypeError: Array.prototype.find requires that |this| not be undefined'");105 shouldThrow("Array.prototype.find.call(null, function() {})", "'TypeError: Array.prototype.find requires that |this| not be null '");104 shouldThrow("Array.prototype.find.call(undefined, function() {})", "'TypeError: Array.prototype.find requires that |this| not be null or undefined'"); 105 shouldThrow("Array.prototype.find.call(null, function() {})", "'TypeError: Array.prototype.find requires that |this| not be null or undefined'"); 106 106 shouldThrow("[].find(1)", "'TypeError: Array.prototype.find callback must be a function'"); 107 107 shouldThrow("[].find('hello')", "'TypeError: Array.prototype.find callback must be a function'"); -
trunk/LayoutTests/js/script-tests/array-findIndex.js
r184848 r203393 104 104 105 105 debug("Exceptions"); 106 shouldThrow("Array.prototype.findIndex.call(undefined, function() {})", "'TypeError: Array.prototype.findIndex requires that |this| not be undefined'");107 shouldThrow("Array.prototype.findIndex.call(null, function() {})", "'TypeError: Array.prototype.findIndex requires that |this| not be null '");106 shouldThrow("Array.prototype.findIndex.call(undefined, function() {})", "'TypeError: Array.prototype.findIndex requires that |this| not be null or undefined'"); 107 shouldThrow("Array.prototype.findIndex.call(null, function() {})", "'TypeError: Array.prototype.findIndex requires that |this| not be null or undefined'"); 108 108 shouldThrow("[].findIndex(1)", "'TypeError: Array.prototype.findIndex callback must be a function'"); 109 109 shouldThrow("[].findIndex('hello')", "'TypeError: Array.prototype.findIndex callback must be a function'"); -
trunk/LayoutTests/js/script-tests/string-localeCompare.js
r200537 r203393 8 8 9 9 // Test RequireObjectCoercible. 10 shouldThrow("String.prototype.localeCompare.call()", "'TypeError: String.prototype.localeCompare requires that |this| not be undefined'");11 shouldThrow("String.prototype.localeCompare.call(undefined)", "'TypeError: String.prototype.localeCompare requires that |this| not be undefined'");12 shouldThrow("String.prototype.localeCompare.call(null)", "'TypeError: String.prototype.localeCompare requires that |this| not be null '");10 shouldThrow("String.prototype.localeCompare.call()", "'TypeError: String.prototype.localeCompare requires that |this| not be null or undefined'"); 11 shouldThrow("String.prototype.localeCompare.call(undefined)", "'TypeError: String.prototype.localeCompare requires that |this| not be null or undefined'"); 12 shouldThrow("String.prototype.localeCompare.call(null)", "'TypeError: String.prototype.localeCompare requires that |this| not be null or undefined'"); 13 13 shouldNotThrow("String.prototype.localeCompare.call({}, '')"); 14 14 shouldNotThrow("String.prototype.localeCompare.call([], '')"); -
trunk/LayoutTests/js/string-localeCompare-expected.txt
r199967 r203393 8 8 PASS Object.getOwnPropertyDescriptor(String.prototype, 'localeCompare').configurable is true 9 9 PASS Object.getOwnPropertyDescriptor(String.prototype, 'localeCompare').writable is true 10 PASS String.prototype.localeCompare.call() threw exception TypeError: String.prototype.localeCompare requires that |this| not be undefined.11 PASS String.prototype.localeCompare.call(undefined) threw exception TypeError: String.prototype.localeCompare requires that |this| not be undefined.12 PASS String.prototype.localeCompare.call(null) threw exception TypeError: String.prototype.localeCompare requires that |this| not be null .10 PASS String.prototype.localeCompare.call() threw exception TypeError: String.prototype.localeCompare requires that |this| not be null or undefined. 11 PASS String.prototype.localeCompare.call(undefined) threw exception TypeError: String.prototype.localeCompare requires that |this| not be null or undefined. 12 PASS String.prototype.localeCompare.call(null) threw exception TypeError: String.prototype.localeCompare requires that |this| not be null or undefined. 13 13 PASS String.prototype.localeCompare.call({}, '') did not throw exception. 14 14 PASS String.prototype.localeCompare.call([], '') did not throw exception. -
trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.10_String.prototype.match/S15.5.4.10_A1_T3-expected.txt
r198554 r203393 1 1 S15.5.4.10_A1_T3 2 2 3 FAIL TypeError: String.prototype.match requires that |this| not be undefined3 FAIL TypeError: String.prototype.match requires that |this| not be null or undefined 4 4 5 5 TEST COMPLETE -
trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.11_String.prototype.replace/S15.5.4.11_A1_T3-expected.txt
r200117 r203393 1 1 S15.5.4.11_A1_T3 2 2 3 FAIL TypeError: String.prototype.replace requires that |this| not be undefined3 FAIL TypeError: String.prototype.replace requires that |this| not be null or undefined 4 4 5 5 TEST COMPLETE -
trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.12_String.prototype.search/S15.5.4.12_A1_T3-expected.txt
r196498 r203393 1 1 S15.5.4.12_A1_T3 2 2 3 FAIL TypeError: String.prototype.search requires that |this| not be undefined3 FAIL TypeError: String.prototype.search requires that |this| not be null or undefined 4 4 5 5 TEST COMPLETE -
trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.14_String.prototype.split/S15.5.4.14_A1_T3-expected.txt
r199731 r203393 1 1 S15.5.4.14_A1_T3 2 2 3 FAIL TypeError: String.prototype.split requires that |this| not be undefined3 FAIL TypeError: String.prototype.split requires that |this| not be null or undefined 4 4 5 5 TEST COMPLETE -
trunk/Source/JavaScriptCore/ChangeLog
r203390 r203393 1 2016-07-18 Joseph Pecoraro <pecoraro@apple.com> 2 3 Make builtin TypeErrors consistent 4 https://bugs.webkit.org/show_bug.cgi?id=159899 5 6 Reviewed by Keith Miller. 7 8 Converge on the single TypeError for non-coercible this objects in builtins. 9 Also update some other style to be more consistent with-in builtins. 10 11 * builtins/ArrayIteratorPrototype.js: 12 (next): 13 * builtins/ArrayPrototype.js: 14 (values): 15 (keys): 16 (entries): 17 (reduce): 18 (reduceRight): 19 (every): 20 (forEach): 21 (filter): 22 (map): 23 (some): 24 (fill): 25 (find): 26 (findIndex): 27 (includes): 28 (sort): 29 (concatSlowPath): 30 (copyWithin): 31 * builtins/StringPrototype.js: 32 (match): 33 (repeat): 34 (padStart): 35 (padEnd): 36 (intrinsic.StringPrototypeReplaceIntrinsic.replace): 37 (localeCompare): 38 (search): 39 (split): 40 * tests/es6/String.prototype_methods_String.prototype.padEnd.js: 41 * tests/es6/String.prototype_methods_String.prototype.padStart.js: 42 * tests/stress/array-iterators-next-error-messages.js: 43 (catch): 44 * tests/stress/array-iterators-next-with-call.js: 45 * tests/stress/regexp-match.js: 46 (shouldThrow): 47 * tests/stress/regexp-search.js: 48 (shouldThrow): 49 1 50 2016-07-17 Filip Pizlo <fpizlo@apple.com> 2 51 -
trunk/Source/JavaScriptCore/builtins/ArrayIteratorPrototype.js
r202280 r203393 29 29 "use strict"; 30 30 31 if (this == null) { 32 if (this === null) 33 throw new @TypeError("%ArrayIteratorPrototype%.next requires that |this| not be null"); 34 throw new @TypeError("%ArrayIteratorPrototype%.next requires that |this| not be undefined"); 35 } 31 if (this == null) 32 throw new @TypeError("%ArrayIteratorPrototype%.next requires that |this| not be null or undefined"); 36 33 37 34 let next = this.@arrayIteratorNext; -
trunk/Source/JavaScriptCore/builtins/ArrayPrototype.js
r202926 r203393 39 39 { 40 40 "use strict"; 41 if (this == null) { 42 if (this === null) 43 throw new @TypeError("Array.prototype.values requires that |this| not be null"); 44 throw new @TypeError("Array.prototype.values requires that |this| not be undefined"); 45 } 41 42 if (this == null) 43 throw new @TypeError("Array.prototype.values requires that |this| not be null or undefined"); 44 46 45 return new @createArrayIterator(@Object(this), "value", @arrayIteratorValueNext); 47 46 } … … 50 49 { 51 50 "use strict"; 52 if (this == null) { 53 if (this === null) 54 throw new @TypeError("Array.prototype.keys requires that |this| not be null"); 55 throw new @TypeError("Array.prototype.keys requires that |this| not be undefined"); 56 } 51 52 if (this == null) 53 throw new @TypeError("Array.prototype.keys requires that |this| not be null or undefined"); 57 54 58 55 return new @createArrayIterator(@Object(this), "key", @arrayIteratorKeyNext); … … 62 59 { 63 60 "use strict"; 64 if (this == null) { 65 if (this === null) 66 throw new @TypeError("Array.prototype.entries requires that |this| not be null"); 67 throw new @TypeError("Array.prototype.entries requires that |this| not be undefined"); 68 } 61 62 if (this == null) 63 throw new @TypeError("Array.prototype.entries requires that |this| not be null or undefined"); 69 64 70 65 return new @createArrayIterator(@Object(this), "key+value", @arrayIteratorKeyValueNext); … … 75 70 "use strict"; 76 71 77 if (this === null) 78 throw new @TypeError("Array.prototype.reduce requires that |this| not be null"); 79 80 if (this === @undefined) 81 throw new @TypeError("Array.prototype.reduce requires that |this| not be undefined"); 72 if (this == null) 73 throw new @TypeError("Array.prototype.reduce requires that |this| not be null or undefined"); 82 74 83 75 var array = @Object(this); … … 113 105 "use strict"; 114 106 115 if (this === null) 116 throw new @TypeError("Array.prototype.reduceRight requires that |this| not be null"); 117 118 if (this === @undefined) 119 throw new @TypeError("Array.prototype.reduceRight requires that |this| not be undefined"); 107 if (this == null) 108 throw new @TypeError("Array.prototype.reduceRight requires that |this| not be null or undefined"); 120 109 121 110 var array = @Object(this); … … 151 140 "use strict"; 152 141 153 if (this === null) 154 throw new @TypeError("Array.prototype.every requires that |this| not be null"); 155 156 if (this === @undefined) 157 throw new @TypeError("Array.prototype.every requires that |this| not be undefined"); 142 if (this == null) 143 throw new @TypeError("Array.prototype.every requires that |this| not be null or undefined"); 158 144 159 145 var array = @Object(this); … … 179 165 "use strict"; 180 166 181 if (this === null) 182 throw new @TypeError("Array.prototype.forEach requires that |this| not be null"); 183 184 if (this === @undefined) 185 throw new @TypeError("Array.prototype.forEach requires that |this| not be undefined"); 167 if (this == null) 168 throw new @TypeError("Array.prototype.forEach requires that |this| not be null or undefined"); 186 169 187 170 var array = @Object(this); … … 203 186 "use strict"; 204 187 205 if (this === null) 206 throw new @TypeError("Array.prototype.filter requires that |this| not be null"); 207 208 if (this === @undefined) 209 throw new @TypeError("Array.prototype.filter requires that |this| not be undefined"); 188 if (this == null) 189 throw new @TypeError("Array.prototype.filter requires that |this| not be null or undefined"); 210 190 211 191 var array = @Object(this); … … 255 235 "use strict"; 256 236 257 if (this === null) 258 throw new @TypeError("Array.prototype.map requires that |this| not be null"); 259 260 if (this === @undefined) 261 throw new @TypeError("Array.prototype.map requires that |this| not be undefined"); 237 if (this == null) 238 throw new @TypeError("Array.prototype.map requires that |this| not be null or undefined"); 262 239 263 240 var array = @Object(this); … … 304 281 "use strict"; 305 282 306 if (this === null) 307 throw new @TypeError("Array.prototype.some requires that |this| not be null"); 308 309 if (this === @undefined) 310 throw new @TypeError("Array.prototype.some requires that |this| not be undefined"); 283 if (this == null) 284 throw new @TypeError("Array.prototype.some requires that |this| not be null or undefined"); 311 285 312 286 var array = @Object(this); … … 330 304 "use strict"; 331 305 332 if (this === null) 333 throw new @TypeError("Array.prototype.fill requires that |this| not be null"); 334 335 if (this === @undefined) 336 throw new @TypeError("Array.prototype.fill requires that |this| not be undefined"); 337 var O = @Object(this); 338 var len = @toLength(O.length); 306 if (this == null) 307 throw new @TypeError("Array.prototype.fill requires that |this| not be null or undefined"); 308 309 var array = @Object(this); 310 var length = @toLength(array.length); 311 339 312 var relativeStart = 0; 340 313 if (arguments.length > 1 && arguments[1] !== @undefined) … … 342 315 var k = 0; 343 316 if (relativeStart < 0) { 344 k = len + relativeStart;317 k = length + relativeStart; 345 318 if (k < 0) 346 319 k = 0; 347 320 } else { 348 321 k = relativeStart; 349 if (k > len )350 k = len ;351 } 352 var relativeEnd = len ;322 if (k > length) 323 k = length; 324 } 325 var relativeEnd = length; 353 326 if (arguments.length > 2 && arguments[2] !== @undefined) 354 327 relativeEnd = arguments[2] | 0; 355 328 var final = 0; 356 329 if (relativeEnd < 0) { 357 final = len + relativeEnd;330 final = length + relativeEnd; 358 331 if (final < 0) 359 332 final = 0; 360 333 } else { 361 334 final = relativeEnd; 362 if (final > len )363 final = len ;335 if (final > length) 336 final = length; 364 337 } 365 338 for (; k < final; k++) 366 O[k] = value;367 return O;339 array[k] = value; 340 return array; 368 341 } 369 342 … … 372 345 "use strict"; 373 346 374 if (this === null) 375 throw new @TypeError("Array.prototype.find requires that |this| not be null"); 376 377 if (this === @undefined) 378 throw new @TypeError("Array.prototype.find requires that |this| not be undefined"); 347 if (this == null) 348 throw new @TypeError("Array.prototype.find requires that |this| not be null or undefined"); 379 349 380 350 var array = @Object(this); … … 397 367 "use strict"; 398 368 399 if (this === null) 400 throw new @TypeError("Array.prototype.findIndex requires that |this| not be null"); 401 402 if (this === @undefined) 403 throw new @TypeError("Array.prototype.findIndex requires that |this| not be undefined"); 369 if (this == null) 370 throw new @TypeError("Array.prototype.findIndex requires that |this| not be null or undefined"); 404 371 405 372 var array = @Object(this); … … 421 388 "use strict"; 422 389 423 if (this === null) 424 throw new @TypeError("Array.prototype.includes requires that |this| not be null"); 425 426 if (this === @undefined) 427 throw new @TypeError("Array.prototype.includes requires that |this| not be undefined"); 390 if (this == null) 391 throw new @TypeError("Array.prototype.includes requires that |this| not be null or undefined"); 428 392 429 393 var array = @Object(this); … … 674 638 } 675 639 676 if (this === null) 677 throw new @TypeError("Array.prototype.sort requires that |this| not be null"); 678 679 if (this === @undefined) 680 throw new @TypeError("Array.prototype.sort requires that |this| not be undefined"); 640 if (this == null) 641 throw new @TypeError("Array.prototype.sort requires that |this| not be null or undefined"); 681 642 682 643 if (typeof this == "string") … … 696 657 { 697 658 "use strict"; 698 if (this == null) { 699 if (this === null) 700 throw new @TypeError("Array.prototype.concat requires that |this| not be null"); 701 throw new @TypeError("Array.prototype.concat requires that |this| not be undefined"); 702 } 659 660 if (this == null) 661 throw new @TypeError("Array.prototype.concat requires that |this| not be null or undefined"); 703 662 704 663 var currentElement = @Object(this); … … 787 746 } 788 747 789 if (this == = null || this === @undefined)748 if (this == null) 790 749 throw new @TypeError("Array.copyWithin requires that |this| not be null or undefined"); 791 var thisObject = @Object(this); 792 793 var length = @toLength( thisObject.length);750 751 var array = @Object(this); 752 var length = @toLength(array.length); 794 753 795 754 var relativeTarget = @toInteger(target); … … 821 780 822 781 for (var i = 0; i < count; ++i, from += direction, to += direction) { 823 if (from in thisObject)824 thisObject[to] = thisObject[from];782 if (from in array) 783 array[to] = array[from]; 825 784 else 826 delete thisObject[to];827 } 828 829 return thisObject;830 } 785 delete array[to]; 786 } 787 788 return array; 789 } -
trunk/Source/JavaScriptCore/builtins/StringPrototype.js
r202966 r203393 30 30 "use strict"; 31 31 32 if (this == null) { 33 if (this === null) 34 throw new @TypeError("String.prototype.match requires that |this| not be null"); 35 throw new @TypeError("String.prototype.match requires that |this| not be undefined"); 36 } 32 if (this == null) 33 throw new @TypeError("String.prototype.match requires that |this| not be null or undefined"); 37 34 38 35 if (regexp != null) { … … 105 102 "use strict"; 106 103 107 if (this == null) { 108 var message = "String.prototype.repeat requires that |this| not be undefined"; 109 if (this === null) 110 message = "String.prototype.repeat requires that |this| not be null"; 111 throw new @TypeError(message); 112 } 104 if (this == null) 105 throw new @TypeError("String.prototype.repeat requires that |this| not be null or undefined"); 113 106 114 107 var string = @toString(this); … … 131 124 "use strict"; 132 125 133 if (this === null) 134 throw new @TypeError("String.prototype.padStart requires that |this| not be null"); 135 136 if (this === @undefined) 137 throw new @TypeError("String.prototype.padStart requires that |this| not be undefined"); 126 if (this == null) 127 throw new @TypeError("String.prototype.padStart requires that |this| not be null or undefined"); 138 128 139 129 var string = @toString(this); … … 171 161 "use strict"; 172 162 173 if (this === null) 174 throw new @TypeError("String.prototype.padEnd requires that |this| not be null"); 175 176 if (this === @undefined) 177 throw new @TypeError("String.prototype.padEnd requires that |this| not be undefined"); 163 if (this == null) 164 throw new @TypeError("String.prototype.padEnd requires that |this| not be null or undefined"); 178 165 179 166 var string = @toString(this); … … 232 219 "use strict"; 233 220 234 if (this == null) { 235 if (this === null) 236 throw new @TypeError("String.prototype.replace requires that |this| not be null"); 237 throw new @TypeError("String.prototype.replace requires that |this| not be undefined"); 238 } 221 if (this == null) 222 throw new @TypeError("String.prototype.replace requires that |this| not be null or undefined"); 239 223 240 224 if (search != null) { … … 260 244 261 245 // 1. Let O be RequireObjectCoercible(this value). 262 if (this === null) 263 throw new @TypeError("String.prototype.localeCompare requires that |this| not be null"); 264 265 if (this === @undefined) 266 throw new @TypeError("String.prototype.localeCompare requires that |this| not be undefined"); 246 if (this == null) 247 throw new @TypeError("String.prototype.localeCompare requires that |this| not be null or undefined"); 267 248 268 249 // 2. Let S be ToString(O). … … 290 271 "use strict"; 291 272 292 if (this == null) { 293 if (this === null) 294 throw new @TypeError("String.prototype.search requires that |this| not be null"); 295 throw new @TypeError("String.prototype.search requires that |this| not be undefined"); 296 } 273 if (this == null) 274 throw new @TypeError("String.prototype.search requires that |this| not be null or undefined"); 297 275 298 276 if (regexp != null) { … … 311 289 "use strict"; 312 290 313 if (this == null) { 314 if (this === null) 315 throw new @TypeError("String.prototype.split requires that |this| not be null"); 316 throw new @TypeError("String.prototype.split requires that |this| not be undefined"); 317 } 291 if (this == null) 292 throw new @TypeError("String.prototype.split requires that |this| not be null or undefined"); 318 293 319 294 if (separator != null) { -
trunk/Source/JavaScriptCore/tests/es6/String.prototype_methods_String.prototype.padEnd.js
r202966 r203393 42 42 (function TestRequireObjectCoercible() { 43 43 var padEnd = String.prototype.padEnd; 44 shouldThrow(() => padEnd.call(null, 4, "test"), "TypeError: String.prototype.padEnd requires that |this| not be null ");45 shouldThrow(() => padEnd.call(undefined, 4, "test"), "TypeError: String.prototype.padEnd requires that |this| not be undefined");44 shouldThrow(() => padEnd.call(null, 4, "test"), "TypeError: String.prototype.padEnd requires that |this| not be null or undefined"); 45 shouldThrow(() => padEnd.call(undefined, 4, "test"), "TypeError: String.prototype.padEnd requires that |this| not be null or undefined"); 46 46 shouldBe("123 ", padEnd.call({ 47 47 __proto__: null, -
trunk/Source/JavaScriptCore/tests/es6/String.prototype_methods_String.prototype.padStart.js
r202966 r203393 42 42 (function TestRequireObjectCoercible() { 43 43 var padStart = String.prototype.padStart; 44 shouldThrow(() => padStart.call(null, 4, "test"), "TypeError: String.prototype.padStart requires that |this| not be null ");45 shouldThrow(() => padStart.call(undefined, 4, "test"), "TypeError: String.prototype.padStart requires that |this| not be undefined");44 shouldThrow(() => padStart.call(null, 4, "test"), "TypeError: String.prototype.padStart requires that |this| not be null or undefined"); 45 shouldThrow(() => padStart.call(undefined, 4, "test"), "TypeError: String.prototype.padStart requires that |this| not be null or undefined"); 46 46 shouldBe(" 123", padStart.call({ 47 47 __proto__: null, -
trunk/Source/JavaScriptCore/tests/stress/array-iterators-next-error-messages.js
r200428 r203393 9 9 next.call(null); 10 10 } catch(e) { 11 assert(e, "TypeError: %ArrayIteratorPrototype%.next requires that |this| not be null ");11 assert(e, "TypeError: %ArrayIteratorPrototype%.next requires that |this| not be null or undefined"); 12 12 } 13 13 … … 15 15 next.call(undefined); 16 16 } catch(e) { 17 assert(e, "TypeError: %ArrayIteratorPrototype%.next requires that |this| not be undefined");17 assert(e, "TypeError: %ArrayIteratorPrototype%.next requires that |this| not be null or undefined"); 18 18 } -
trunk/Source/JavaScriptCore/tests/stress/array-iterators-next-with-call.js
r200434 r203393 86 86 var expectedMessage = 'TypeError: %ArrayIteratorPrototype%.next requires that |this| be an Array Iterator instance'; 87 87 if (primitive === null) 88 expectedMessage = 'TypeError: %ArrayIteratorPrototype%.next requires that |this| not be null ';88 expectedMessage = 'TypeError: %ArrayIteratorPrototype%.next requires that |this| not be null or undefined'; 89 89 if (primitive === undefined) 90 expectedMessage = 'TypeError: %ArrayIteratorPrototype%.next requires that |this| not be undefined';90 expectedMessage = 'TypeError: %ArrayIteratorPrototype%.next requires that |this| not be null or undefined'; 91 91 if (String(didThrow) !== expectedMessage) 92 92 throw "Error: bad error thrown: " + didThrow; -
trunk/Source/JavaScriptCore/tests/stress/regexp-match.js
r198554 r203393 26 26 shouldThrow(function () { 27 27 String.prototype.match.call(null, /Cocoa/); 28 }, "TypeError: String.prototype.match requires that |this| not be null ");28 }, "TypeError: String.prototype.match requires that |this| not be null or undefined"); 29 29 30 30 shouldThrow(function () { 31 31 String.prototype.match.call(undefined, /Cocoa/); 32 }, "TypeError: String.prototype.match requires that |this| not be undefined");32 }, "TypeError: String.prototype.match requires that |this| not be null or undefined"); 33 33 34 34 shouldThrow(function () { -
trunk/Source/JavaScriptCore/tests/stress/regexp-search.js
r199748 r203393 26 26 shouldThrow(function () { 27 27 String.prototype.search.call(null, /Cocoa/); 28 }, "TypeError: String.prototype.search requires that |this| not be null ");28 }, "TypeError: String.prototype.search requires that |this| not be null or undefined"); 29 29 30 30 shouldThrow(function () { 31 31 String.prototype.search.call(undefined, /Cocoa/); 32 }, "TypeError: String.prototype.search requires that |this| not be undefined");32 }, "TypeError: String.prototype.search requires that |this| not be null or undefined"); 33 33 34 34 shouldThrow(function () {
Note:
See TracChangeset
for help on using the changeset viewer.