Diff
Modified: trunk/LayoutTests/ChangeLog (203392 => 203393)
--- trunk/LayoutTests/ChangeLog 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/LayoutTests/ChangeLog 2016-07-19 02:45:35 UTC (rev 203393)
@@ -1,3 +1,25 @@
+2016-07-18 Joseph Pecoraro <[email protected]>
+
+ Make builtin TypeErrors consistent
+ https://bugs.webkit.org/show_bug.cgi?id=159899
+
+ Reviewed by Keith Miller.
+
+ * js/array-find-expected.txt:
+ * js/array-findIndex-expected.txt:
+ * js/array-includes-expected.txt:
+ * js/dom/array-prototype-properties-expected.txt:
+ * js/dom/script-tests/string-prototype-properties.js:
+ * js/dom/string-prototype-properties-expected.txt:
+ * js/script-tests/array-find.js:
+ * js/script-tests/array-findIndex.js:
+ * js/script-tests/string-localeCompare.js:
+ * js/string-localeCompare-expected.txt:
+ * 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:
+ * 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:
+ * 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:
+ * 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:
+
2016-07-18 Chris Dumez <[email protected]>
EventTarget.dispatchEvent() parameter should not be nullable
Modified: trunk/LayoutTests/js/array-find-expected.txt (203392 => 203393)
--- trunk/LayoutTests/js/array-find-expected.txt 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/LayoutTests/js/array-find-expected.txt 2016-07-19 02:45:35 UTC (rev 203393)
@@ -42,8 +42,8 @@
PASS [0,1,2,3,4,5,6,7,8,9].find(findItemAddedDuringSearch) is undefined
PASS [0,1,2,3,4,5,6,7,8,9].find(findItemRemovedDuringSearch) is undefined
Exceptions
-PASS Array.prototype.find.call(undefined, function() {}) threw exception TypeError: Array.prototype.find requires that |this| not be undefined.
-PASS Array.prototype.find.call(null, function() {}) threw exception TypeError: Array.prototype.find requires that |this| not be null.
+PASS Array.prototype.find.call(undefined, function() {}) threw exception TypeError: Array.prototype.find requires that |this| not be null or undefined.
+PASS Array.prototype.find.call(null, function() {}) threw exception TypeError: Array.prototype.find requires that |this| not be null or undefined.
PASS [].find(1) threw exception TypeError: Array.prototype.find callback must be a function.
PASS [].find('hello') threw exception TypeError: Array.prototype.find callback must be a function.
PASS [].find([]) threw exception TypeError: Array.prototype.find callback must be a function.
Modified: trunk/LayoutTests/js/array-findIndex-expected.txt (203392 => 203393)
--- trunk/LayoutTests/js/array-findIndex-expected.txt 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/LayoutTests/js/array-findIndex-expected.txt 2016-07-19 02:45:35 UTC (rev 203393)
@@ -43,8 +43,8 @@
PASS [0,1,2,3,4,5,6,7,8,9].findIndex(findItemAddedDuringSearch) is -1
PASS [0,1,2,3,4,5,6,7,8,9].findIndex(findItemRemovedDuringSearch) is -1
Exceptions
-PASS Array.prototype.findIndex.call(undefined, function() {}) threw exception TypeError: Array.prototype.findIndex requires that |this| not be undefined.
-PASS Array.prototype.findIndex.call(null, function() {}) threw exception TypeError: Array.prototype.findIndex requires that |this| not be null.
+PASS Array.prototype.findIndex.call(undefined, function() {}) threw exception TypeError: Array.prototype.findIndex requires that |this| not be null or undefined.
+PASS Array.prototype.findIndex.call(null, function() {}) threw exception TypeError: Array.prototype.findIndex requires that |this| not be null or undefined.
PASS [].findIndex(1) threw exception TypeError: Array.prototype.findIndex callback must be a function.
PASS [].findIndex('hello') threw exception TypeError: Array.prototype.findIndex callback must be a function.
PASS [].findIndex([]) threw exception TypeError: Array.prototype.findIndex callback must be a function.
Modified: trunk/LayoutTests/js/array-includes-expected.txt (203392 => 203393)
--- trunk/LayoutTests/js/array-includes-expected.txt 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/LayoutTests/js/array-includes-expected.txt 2016-07-19 02:45:35 UTC (rev 203393)
@@ -28,8 +28,8 @@
PASS a.includes('sausage') is true
PASS a.includes('hashbrown') is false
PASS a.includes('toast') is false
-PASS Array.prototype.includes.call(undefined, 1) threw exception TypeError: Array.prototype.includes requires that |this| not be undefined.
-PASS Array.prototype.includes.call(null, 1) threw exception TypeError: Array.prototype.includes requires that |this| not be null.
+PASS Array.prototype.includes.call(undefined, 1) threw exception TypeError: Array.prototype.includes requires that |this| not be null or undefined.
+PASS Array.prototype.includes.call(null, 1) threw exception TypeError: Array.prototype.includes requires that |this| not be null or undefined.
Array-like object with invalid lengths
PASS var obj = { 0: 1, 1: 1, 2: 1, length: 0 }; Array.prototype.includes.call(obj, 1) is false
PASS var obj = { 0: 1, 1: 1, 2: 1, length: -0 }; Array.prototype.includes.call(obj, 1) is false
Modified: trunk/LayoutTests/js/dom/array-prototype-properties-expected.txt (203392 => 203393)
--- trunk/LayoutTests/js/dom/array-prototype-properties-expected.txt 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/LayoutTests/js/dom/array-prototype-properties-expected.txt 2016-07-19 02:45:35 UTC (rev 203393)
@@ -5,7 +5,7 @@
PASS Array.prototype.toString.call(undefined) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.toString.call(undefined)').
PASS Array.prototype.toLocaleString.call(undefined) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.toLocaleString.call(undefined)').
-PASS Array.prototype.concat.call(undefined, []) threw exception TypeError: Array.prototype.concat requires that |this| not be undefined.
+PASS Array.prototype.concat.call(undefined, []) threw exception TypeError: Array.prototype.concat requires that |this| not be null or undefined.
PASS Array.prototype.join.call(undefined, []) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.join.call(undefined, [])').
PASS Array.prototype.pop.call(undefined) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.pop.call(undefined)').
PASS Array.prototype.push.call(undefined, {}) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.push.call(undefined, {})').
@@ -12,18 +12,18 @@
PASS Array.prototype.reverse.call(undefined) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.reverse.call(undefined)').
PASS Array.prototype.shift.call(undefined) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.shift.call(undefined)').
PASS Array.prototype.slice.call(undefined, 0, 1) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.slice.call(undefined, 0, 1)').
-PASS Array.prototype.sort.call(undefined) threw exception TypeError: Array.prototype.sort requires that |this| not be undefined.
+PASS Array.prototype.sort.call(undefined) threw exception TypeError: Array.prototype.sort requires that |this| not be null or undefined.
PASS Array.prototype.splice.call(undefined, 0, 1) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.splice.call(undefined, 0, 1)').
PASS Array.prototype.unshift.call(undefined, {}) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.unshift.call(undefined, {})').
-PASS Array.prototype.every.call(undefined, toString) threw exception TypeError: Array.prototype.every requires that |this| not be undefined.
-PASS Array.prototype.forEach.call(undefined, toString) threw exception TypeError: Array.prototype.forEach requires that |this| not be undefined.
-PASS Array.prototype.some.call(undefined, toString) threw exception TypeError: Array.prototype.some requires that |this| not be undefined.
+PASS Array.prototype.every.call(undefined, toString) threw exception TypeError: Array.prototype.every requires that |this| not be null or undefined.
+PASS Array.prototype.forEach.call(undefined, toString) threw exception TypeError: Array.prototype.forEach requires that |this| not be null or undefined.
+PASS Array.prototype.some.call(undefined, toString) threw exception TypeError: Array.prototype.some requires that |this| not be null or undefined.
PASS Array.prototype.indexOf.call(undefined, 0) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.indexOf.call(undefined, 0)').
PASS Array.prototype.lastIndexOf.call(undefined, 0) threw exception TypeError: undefined is not an object (evaluating 'Array.prototype.lastIndexOf.call(undefined, 0)').
-PASS Array.prototype.filter.call(undefined, toString) threw exception TypeError: Array.prototype.filter requires that |this| not be undefined.
-PASS Array.prototype.reduce.call(undefined, toString) threw exception TypeError: Array.prototype.reduce requires that |this| not be undefined.
-PASS Array.prototype.reduceRight.call(undefined, toString) threw exception TypeError: Array.prototype.reduceRight requires that |this| not be undefined.
-PASS Array.prototype.map.call(undefined, toString) threw exception TypeError: Array.prototype.map requires that |this| not be undefined.
+PASS Array.prototype.filter.call(undefined, toString) threw exception TypeError: Array.prototype.filter requires that |this| not be null or undefined.
+PASS Array.prototype.reduce.call(undefined, toString) threw exception TypeError: Array.prototype.reduce requires that |this| not be null or undefined.
+PASS Array.prototype.reduceRight.call(undefined, toString) threw exception TypeError: Array.prototype.reduceRight requires that |this| not be null or undefined.
+PASS Array.prototype.map.call(undefined, toString) threw exception TypeError: Array.prototype.map requires that |this| not be null or undefined.
PASS [{toLocaleString:function(){throw 1}},{toLocaleString:function(){throw 2}}].toLocaleString() threw exception 1.
PASS successfullyParsed is true
Modified: trunk/LayoutTests/js/dom/script-tests/string-prototype-properties.js (203392 => 203393)
--- trunk/LayoutTests/js/dom/script-tests/string-prototype-properties.js 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/LayoutTests/js/dom/script-tests/string-prototype-properties.js 2016-07-19 02:45:35 UTC (rev 203393)
@@ -20,7 +20,7 @@
shouldThrow("String.prototype.substring.call(undefined, 1, 3)");
shouldThrow("String.prototype.toLowerCase.call(undefined)");
shouldThrow("String.prototype.toUpperCase.call(undefined)");
-shouldThrow("String.prototype.localeCompare.call(undefined, '1224')", "'TypeError: String.prototype.localeCompare requires that |this| not be undefined'");
+shouldThrow("String.prototype.localeCompare.call(undefined, '1224')", "'TypeError: String.prototype.localeCompare requires that |this| not be null or undefined'");
shouldThrow("String.prototype.toLocaleLowerCase.call(undefined)");
shouldThrow("String.prototype.toLocaleUpperCase.call(undefined)");
shouldThrow("String.prototype.trim.call(undefined)");
Modified: trunk/LayoutTests/js/dom/string-prototype-properties-expected.txt (203392 => 203393)
--- trunk/LayoutTests/js/dom/string-prototype-properties-expected.txt 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/LayoutTests/js/dom/string-prototype-properties-expected.txt 2016-07-19 02:45:35 UTC (rev 203393)
@@ -10,17 +10,17 @@
PASS String.prototype.concat.call(undefined, 'five') threw exception TypeError: Type error.
PASS String.prototype.indexOf.call(undefined, '2') threw exception TypeError: Type error.
PASS String.prototype.lastIndexOf.call(undefined, '2') threw exception TypeError: Type error.
-PASS String.prototype.match.call(undefined, /2+/) threw exception TypeError: String.prototype.match requires that |this| not be undefined.
-PASS String.prototype.replace.call(undefined, /2+/, '-') threw exception TypeError: String.prototype.replace requires that |this| not be undefined.
-PASS String.prototype.search.call(undefined, '4') threw exception TypeError: String.prototype.search requires that |this| not be undefined.
+PASS String.prototype.match.call(undefined, /2+/) threw exception TypeError: String.prototype.match requires that |this| not be null or undefined.
+PASS String.prototype.replace.call(undefined, /2+/, '-') threw exception TypeError: String.prototype.replace requires that |this| not be null or undefined.
+PASS String.prototype.search.call(undefined, '4') threw exception TypeError: String.prototype.search requires that |this| not be null or undefined.
PASS String.prototype.slice.call(undefined, 1, 3) threw exception TypeError: Type error.
-PASS String.prototype.split.call(undefined, '2') threw exception TypeError: String.prototype.split requires that |this| not be undefined.
+PASS String.prototype.split.call(undefined, '2') threw exception TypeError: String.prototype.split requires that |this| not be null or undefined.
PASS String.prototype.slice.call(undefined, 1, 3) threw exception TypeError: Type error.
PASS String.prototype.substr.call(undefined, 1, 3) threw exception TypeError: Type error.
PASS String.prototype.substring.call(undefined, 1, 3) threw exception TypeError: Type error.
PASS String.prototype.toLowerCase.call(undefined) threw exception TypeError: Type error.
PASS String.prototype.toUpperCase.call(undefined) threw exception TypeError: Type error.
-PASS String.prototype.localeCompare.call(undefined, '1224') threw exception TypeError: String.prototype.localeCompare requires that |this| not be undefined.
+PASS String.prototype.localeCompare.call(undefined, '1224') threw exception TypeError: String.prototype.localeCompare requires that |this| not be null or undefined.
PASS String.prototype.toLocaleLowerCase.call(undefined) threw exception TypeError: Type error.
PASS String.prototype.toLocaleUpperCase.call(undefined) threw exception TypeError: Type error.
PASS String.prototype.trim.call(undefined) threw exception TypeError: Type error.
Modified: trunk/LayoutTests/js/script-tests/array-find.js (203392 => 203393)
--- trunk/LayoutTests/js/script-tests/array-find.js 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/LayoutTests/js/script-tests/array-find.js 2016-07-19 02:45:35 UTC (rev 203393)
@@ -101,8 +101,8 @@
shouldBe("[0,1,2,3,4,5,6,7,8,9].find(findItemRemovedDuringSearch)", "undefined");
debug("Exceptions");
-shouldThrow("Array.prototype.find.call(undefined, function() {})", "'TypeError: Array.prototype.find requires that |this| not be undefined'");
-shouldThrow("Array.prototype.find.call(null, function() {})", "'TypeError: Array.prototype.find requires that |this| not be null'");
+shouldThrow("Array.prototype.find.call(undefined, function() {})", "'TypeError: Array.prototype.find requires that |this| not be null or undefined'");
+shouldThrow("Array.prototype.find.call(null, function() {})", "'TypeError: Array.prototype.find requires that |this| not be null or undefined'");
shouldThrow("[].find(1)", "'TypeError: Array.prototype.find callback must be a function'");
shouldThrow("[].find('hello')", "'TypeError: Array.prototype.find callback must be a function'");
shouldThrow("[].find([])", "'TypeError: Array.prototype.find callback must be a function'");
Modified: trunk/LayoutTests/js/script-tests/array-findIndex.js (203392 => 203393)
--- trunk/LayoutTests/js/script-tests/array-findIndex.js 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/LayoutTests/js/script-tests/array-findIndex.js 2016-07-19 02:45:35 UTC (rev 203393)
@@ -103,8 +103,8 @@
shouldBe("[0,1,2,3,4,5,6,7,8,9].findIndex(findItemRemovedDuringSearch)", "-1");
debug("Exceptions");
-shouldThrow("Array.prototype.findIndex.call(undefined, function() {})", "'TypeError: Array.prototype.findIndex requires that |this| not be undefined'");
-shouldThrow("Array.prototype.findIndex.call(null, function() {})", "'TypeError: Array.prototype.findIndex requires that |this| not be null'");
+shouldThrow("Array.prototype.findIndex.call(undefined, function() {})", "'TypeError: Array.prototype.findIndex requires that |this| not be null or undefined'");
+shouldThrow("Array.prototype.findIndex.call(null, function() {})", "'TypeError: Array.prototype.findIndex requires that |this| not be null or undefined'");
shouldThrow("[].findIndex(1)", "'TypeError: Array.prototype.findIndex callback must be a function'");
shouldThrow("[].findIndex('hello')", "'TypeError: Array.prototype.findIndex callback must be a function'");
shouldThrow("[].findIndex([])", "'TypeError: Array.prototype.findIndex callback must be a function'");
Modified: trunk/LayoutTests/js/script-tests/string-localeCompare.js (203392 => 203393)
--- trunk/LayoutTests/js/script-tests/string-localeCompare.js 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/LayoutTests/js/script-tests/string-localeCompare.js 2016-07-19 02:45:35 UTC (rev 203393)
@@ -7,9 +7,9 @@
shouldBeTrue("Object.getOwnPropertyDescriptor(String.prototype, 'localeCompare').writable");
// Test RequireObjectCoercible.
-shouldThrow("String.prototype.localeCompare.call()", "'TypeError: String.prototype.localeCompare requires that |this| not be undefined'");
-shouldThrow("String.prototype.localeCompare.call(undefined)", "'TypeError: String.prototype.localeCompare requires that |this| not be undefined'");
-shouldThrow("String.prototype.localeCompare.call(null)", "'TypeError: String.prototype.localeCompare requires that |this| not be null'");
+shouldThrow("String.prototype.localeCompare.call()", "'TypeError: String.prototype.localeCompare requires that |this| not be null or undefined'");
+shouldThrow("String.prototype.localeCompare.call(undefined)", "'TypeError: String.prototype.localeCompare requires that |this| not be null or undefined'");
+shouldThrow("String.prototype.localeCompare.call(null)", "'TypeError: String.prototype.localeCompare requires that |this| not be null or undefined'");
shouldNotThrow("String.prototype.localeCompare.call({}, '')");
shouldNotThrow("String.prototype.localeCompare.call([], '')");
shouldNotThrow("String.prototype.localeCompare.call(NaN, '')");
Modified: trunk/LayoutTests/js/string-localeCompare-expected.txt (203392 => 203393)
--- trunk/LayoutTests/js/string-localeCompare-expected.txt 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/LayoutTests/js/string-localeCompare-expected.txt 2016-07-19 02:45:35 UTC (rev 203393)
@@ -7,9 +7,9 @@
PASS Object.getOwnPropertyDescriptor(String.prototype, 'localeCompare').enumerable is false
PASS Object.getOwnPropertyDescriptor(String.prototype, 'localeCompare').configurable is true
PASS Object.getOwnPropertyDescriptor(String.prototype, 'localeCompare').writable is true
-PASS String.prototype.localeCompare.call() threw exception TypeError: String.prototype.localeCompare requires that |this| not be undefined.
-PASS String.prototype.localeCompare.call(undefined) threw exception TypeError: String.prototype.localeCompare requires that |this| not be undefined.
-PASS String.prototype.localeCompare.call(null) threw exception TypeError: String.prototype.localeCompare requires that |this| not be null.
+PASS String.prototype.localeCompare.call() threw exception TypeError: String.prototype.localeCompare requires that |this| not be null or undefined.
+PASS String.prototype.localeCompare.call(undefined) threw exception TypeError: String.prototype.localeCompare requires that |this| not be null or undefined.
+PASS String.prototype.localeCompare.call(null) threw exception TypeError: String.prototype.localeCompare requires that |this| not be null or undefined.
PASS String.prototype.localeCompare.call({}, '') did not throw exception.
PASS String.prototype.localeCompare.call([], '') did not throw exception.
PASS String.prototype.localeCompare.call(NaN, '') did not throw exception.
Modified: 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 (203392 => 203393)
--- 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 2016-07-19 02:02:37 UTC (rev 203392)
+++ 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 2016-07-19 02:45:35 UTC (rev 203393)
@@ -1,6 +1,6 @@
S15.5.4.10_A1_T3
-FAIL TypeError: String.prototype.match requires that |this| not be undefined
+FAIL TypeError: String.prototype.match requires that |this| not be null or undefined
TEST COMPLETE
Modified: 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 (203392 => 203393)
--- 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 2016-07-19 02:02:37 UTC (rev 203392)
+++ 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 2016-07-19 02:45:35 UTC (rev 203393)
@@ -1,6 +1,6 @@
S15.5.4.11_A1_T3
-FAIL TypeError: String.prototype.replace requires that |this| not be undefined
+FAIL TypeError: String.prototype.replace requires that |this| not be null or undefined
TEST COMPLETE
Modified: 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 (203392 => 203393)
--- 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 2016-07-19 02:02:37 UTC (rev 203392)
+++ 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 2016-07-19 02:45:35 UTC (rev 203393)
@@ -1,6 +1,6 @@
S15.5.4.12_A1_T3
-FAIL TypeError: String.prototype.search requires that |this| not be undefined
+FAIL TypeError: String.prototype.search requires that |this| not be null or undefined
TEST COMPLETE
Modified: 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 (203392 => 203393)
--- 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 2016-07-19 02:02:37 UTC (rev 203392)
+++ 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 2016-07-19 02:45:35 UTC (rev 203393)
@@ -1,6 +1,6 @@
S15.5.4.14_A1_T3
-FAIL TypeError: String.prototype.split requires that |this| not be undefined
+FAIL TypeError: String.prototype.split requires that |this| not be null or undefined
TEST COMPLETE
Modified: trunk/Source/_javascript_Core/ChangeLog (203392 => 203393)
--- trunk/Source/_javascript_Core/ChangeLog 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-07-19 02:45:35 UTC (rev 203393)
@@ -1,3 +1,52 @@
+2016-07-18 Joseph Pecoraro <[email protected]>
+
+ Make builtin TypeErrors consistent
+ https://bugs.webkit.org/show_bug.cgi?id=159899
+
+ Reviewed by Keith Miller.
+
+ Converge on the single TypeError for non-coercible this objects in builtins.
+ Also update some other style to be more consistent with-in builtins.
+
+ * builtins/ArrayIteratorPrototype.js:
+ (next):
+ * builtins/ArrayPrototype.js:
+ (values):
+ (keys):
+ (entries):
+ (reduce):
+ (reduceRight):
+ (every):
+ (forEach):
+ (filter):
+ (map):
+ (some):
+ (fill):
+ (find):
+ (findIndex):
+ (includes):
+ (sort):
+ (concatSlowPath):
+ (copyWithin):
+ * builtins/StringPrototype.js:
+ (match):
+ (repeat):
+ (padStart):
+ (padEnd):
+ (intrinsic.StringPrototypeReplaceIntrinsic.replace):
+ (localeCompare):
+ (search):
+ (split):
+ * tests/es6/String.prototype_methods_String.prototype.padEnd.js:
+ * tests/es6/String.prototype_methods_String.prototype.padStart.js:
+ * tests/stress/array-iterators-next-error-messages.js:
+ (catch):
+ * tests/stress/array-iterators-next-with-call.js:
+ * tests/stress/regexp-match.js:
+ (shouldThrow):
+ * tests/stress/regexp-search.js:
+ (shouldThrow):
+
2016-07-17 Filip Pizlo <[email protected]>
Implement table-based switches in B3/Air
Modified: trunk/Source/_javascript_Core/builtins/ArrayIteratorPrototype.js (203392 => 203393)
--- trunk/Source/_javascript_Core/builtins/ArrayIteratorPrototype.js 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/Source/_javascript_Core/builtins/ArrayIteratorPrototype.js 2016-07-19 02:45:35 UTC (rev 203393)
@@ -28,11 +28,8 @@
{
"use strict";
- if (this == null) {
- if (this === null)
- throw new @TypeError("%ArrayIteratorPrototype%.next requires that |this| not be null");
- throw new @TypeError("%ArrayIteratorPrototype%.next requires that |this| not be undefined");
- }
+ if (this == null)
+ throw new @TypeError("%ArrayIteratorPrototype%.next requires that |this| not be null or undefined");
let next = this.@arrayIteratorNext;
if (next === @undefined)
Modified: trunk/Source/_javascript_Core/builtins/ArrayPrototype.js (203392 => 203393)
--- trunk/Source/_javascript_Core/builtins/ArrayPrototype.js 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/Source/_javascript_Core/builtins/ArrayPrototype.js 2016-07-19 02:45:35 UTC (rev 203393)
@@ -38,11 +38,10 @@
function values()
{
"use strict";
- if (this == null) {
- if (this === null)
- throw new @TypeError("Array.prototype.values requires that |this| not be null");
- throw new @TypeError("Array.prototype.values requires that |this| not be undefined");
- }
+
+ if (this == null)
+ throw new @TypeError("Array.prototype.values requires that |this| not be null or undefined");
+
return new @createArrayIterator(@Object(this), "value", @arrayIteratorValueNext);
}
@@ -49,12 +48,10 @@
function keys()
{
"use strict";
- if (this == null) {
- if (this === null)
- throw new @TypeError("Array.prototype.keys requires that |this| not be null");
- throw new @TypeError("Array.prototype.keys requires that |this| not be undefined");
- }
+ if (this == null)
+ throw new @TypeError("Array.prototype.keys requires that |this| not be null or undefined");
+
return new @createArrayIterator(@Object(this), "key", @arrayIteratorKeyNext);
}
@@ -61,12 +58,10 @@
function entries()
{
"use strict";
- if (this == null) {
- if (this === null)
- throw new @TypeError("Array.prototype.entries requires that |this| not be null");
- throw new @TypeError("Array.prototype.entries requires that |this| not be undefined");
- }
+ if (this == null)
+ throw new @TypeError("Array.prototype.entries requires that |this| not be null or undefined");
+
return new @createArrayIterator(@Object(this), "key+value", @arrayIteratorKeyValueNext);
}
@@ -74,12 +69,9 @@
{
"use strict";
- if (this === null)
- throw new @TypeError("Array.prototype.reduce requires that |this| not be null");
+ if (this == null)
+ throw new @TypeError("Array.prototype.reduce requires that |this| not be null or undefined");
- if (this === @undefined)
- throw new @TypeError("Array.prototype.reduce requires that |this| not be undefined");
-
var array = @Object(this);
var length = @toLength(array.length);
@@ -112,12 +104,9 @@
{
"use strict";
- if (this === null)
- throw new @TypeError("Array.prototype.reduceRight requires that |this| not be null");
+ if (this == null)
+ throw new @TypeError("Array.prototype.reduceRight requires that |this| not be null or undefined");
- if (this === @undefined)
- throw new @TypeError("Array.prototype.reduceRight requires that |this| not be undefined");
-
var array = @Object(this);
var length = @toLength(array.length);
@@ -150,12 +139,9 @@
{
"use strict";
- if (this === null)
- throw new @TypeError("Array.prototype.every requires that |this| not be null");
+ if (this == null)
+ throw new @TypeError("Array.prototype.every requires that |this| not be null or undefined");
- if (this === @undefined)
- throw new @TypeError("Array.prototype.every requires that |this| not be undefined");
-
var array = @Object(this);
var length = @toLength(array.length);
@@ -178,12 +164,9 @@
{
"use strict";
- if (this === null)
- throw new @TypeError("Array.prototype.forEach requires that |this| not be null");
+ if (this == null)
+ throw new @TypeError("Array.prototype.forEach requires that |this| not be null or undefined");
- if (this === @undefined)
- throw new @TypeError("Array.prototype.forEach requires that |this| not be undefined");
-
var array = @Object(this);
var length = @toLength(array.length);
@@ -202,12 +185,9 @@
{
"use strict";
- if (this === null)
- throw new @TypeError("Array.prototype.filter requires that |this| not be null");
+ if (this == null)
+ throw new @TypeError("Array.prototype.filter requires that |this| not be null or undefined");
- if (this === @undefined)
- throw new @TypeError("Array.prototype.filter requires that |this| not be undefined");
-
var array = @Object(this);
var length = @toLength(array.length);
@@ -254,12 +234,9 @@
{
"use strict";
- if (this === null)
- throw new @TypeError("Array.prototype.map requires that |this| not be null");
+ if (this == null)
+ throw new @TypeError("Array.prototype.map requires that |this| not be null or undefined");
- if (this === @undefined)
- throw new @TypeError("Array.prototype.map requires that |this| not be undefined");
-
var array = @Object(this);
var length = @toLength(array.length);
@@ -303,12 +280,9 @@
{
"use strict";
- if (this === null)
- throw new @TypeError("Array.prototype.some requires that |this| not be null");
+ if (this == null)
+ throw new @TypeError("Array.prototype.some requires that |this| not be null or undefined");
- if (this === @undefined)
- throw new @TypeError("Array.prototype.some requires that |this| not be undefined");
-
var array = @Object(this);
var length = @toLength(array.length);
@@ -329,42 +303,41 @@
{
"use strict";
- if (this === null)
- throw new @TypeError("Array.prototype.fill requires that |this| not be null");
-
- if (this === @undefined)
- throw new @TypeError("Array.prototype.fill requires that |this| not be undefined");
- var O = @Object(this);
- var len = @toLength(O.length);
+ if (this == null)
+ throw new @TypeError("Array.prototype.fill requires that |this| not be null or undefined");
+
+ var array = @Object(this);
+ var length = @toLength(array.length);
+
var relativeStart = 0;
if (arguments.length > 1 && arguments[1] !== @undefined)
relativeStart = arguments[1] | 0;
var k = 0;
if (relativeStart < 0) {
- k = len + relativeStart;
+ k = length + relativeStart;
if (k < 0)
k = 0;
} else {
k = relativeStart;
- if (k > len)
- k = len;
+ if (k > length)
+ k = length;
}
- var relativeEnd = len;
+ var relativeEnd = length;
if (arguments.length > 2 && arguments[2] !== @undefined)
relativeEnd = arguments[2] | 0;
var final = 0;
if (relativeEnd < 0) {
- final = len + relativeEnd;
+ final = length + relativeEnd;
if (final < 0)
final = 0;
} else {
final = relativeEnd;
- if (final > len)
- final = len;
+ if (final > length)
+ final = length;
}
for (; k < final; k++)
- O[k] = value;
- return O;
+ array[k] = value;
+ return array;
}
function find(callback /*, thisArg */)
@@ -371,12 +344,9 @@
{
"use strict";
- if (this === null)
- throw new @TypeError("Array.prototype.find requires that |this| not be null");
+ if (this == null)
+ throw new @TypeError("Array.prototype.find requires that |this| not be null or undefined");
- if (this === @undefined)
- throw new @TypeError("Array.prototype.find requires that |this| not be undefined");
-
var array = @Object(this);
var length = @toLength(array.length);
@@ -396,12 +366,9 @@
{
"use strict";
- if (this === null)
- throw new @TypeError("Array.prototype.findIndex requires that |this| not be null");
+ if (this == null)
+ throw new @TypeError("Array.prototype.findIndex requires that |this| not be null or undefined");
- if (this === @undefined)
- throw new @TypeError("Array.prototype.findIndex requires that |this| not be undefined");
-
var array = @Object(this);
var length = @toLength(array.length);
@@ -420,12 +387,9 @@
{
"use strict";
- if (this === null)
- throw new @TypeError("Array.prototype.includes requires that |this| not be null");
+ if (this == null)
+ throw new @TypeError("Array.prototype.includes requires that |this| not be null or undefined");
- if (this === @undefined)
- throw new @TypeError("Array.prototype.includes requires that |this| not be undefined");
-
var array = @Object(this);
var length = @toLength(array.length);
@@ -673,12 +637,9 @@
bucketSort(array, 0, strings, 0);
}
- if (this === null)
- throw new @TypeError("Array.prototype.sort requires that |this| not be null");
+ if (this == null)
+ throw new @TypeError("Array.prototype.sort requires that |this| not be null or undefined");
- if (this === @undefined)
- throw new @TypeError("Array.prototype.sort requires that |this| not be undefined");
-
if (typeof this == "string")
throw new @TypeError("Attempted to assign to readonly property.");
@@ -695,12 +656,10 @@
function concatSlowPath()
{
"use strict";
- if (this == null) {
- if (this === null)
- throw new @TypeError("Array.prototype.concat requires that |this| not be null");
- throw new @TypeError("Array.prototype.concat requires that |this| not be undefined");
- }
+ if (this == null)
+ throw new @TypeError("Array.prototype.concat requires that |this| not be null or undefined");
+
var currentElement = @Object(this);
var constructor;
@@ -786,11 +745,11 @@
return (maybeNegativeZero < positive) ? maybeNegativeZero : positive;
}
- if (this === null || this === @undefined)
+ if (this == null)
throw new @TypeError("Array.copyWithin requires that |this| not be null or undefined");
- var thisObject = @Object(this);
- var length = @toLength(thisObject.length);
+ var array = @Object(this);
+ var length = @toLength(array.length);
var relativeTarget = @toInteger(target);
var to = (relativeTarget < 0) ? maxWithPositives(length + relativeTarget, 0) : minWithMaybeNegativeZeroAndPositive(relativeTarget, length);
@@ -820,11 +779,11 @@
}
for (var i = 0; i < count; ++i, from += direction, to += direction) {
- if (from in thisObject)
- thisObject[to] = thisObject[from];
+ if (from in array)
+ array[to] = array[from];
else
- delete thisObject[to];
+ delete array[to];
}
- return thisObject;
+ return array;
}
Modified: trunk/Source/_javascript_Core/builtins/StringPrototype.js (203392 => 203393)
--- trunk/Source/_javascript_Core/builtins/StringPrototype.js 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/Source/_javascript_Core/builtins/StringPrototype.js 2016-07-19 02:45:35 UTC (rev 203393)
@@ -29,11 +29,8 @@
{
"use strict";
- if (this == null) {
- if (this === null)
- throw new @TypeError("String.prototype.match requires that |this| not be null");
- throw new @TypeError("String.prototype.match requires that |this| not be undefined");
- }
+ if (this == null)
+ throw new @TypeError("String.prototype.match requires that |this| not be null or undefined");
if (regexp != null) {
var matcher = regexp.@matchSymbol;
@@ -104,12 +101,8 @@
{
"use strict";
- if (this == null) {
- var message = "String.prototype.repeat requires that |this| not be undefined";
- if (this === null)
- message = "String.prototype.repeat requires that |this| not be null";
- throw new @TypeError(message);
- }
+ if (this == null)
+ throw new @TypeError("String.prototype.repeat requires that |this| not be null or undefined");
var string = @toString(this);
count = @toInteger(count);
@@ -130,11 +123,8 @@
{
"use strict";
- if (this === null)
- throw new @TypeError("String.prototype.padStart requires that |this| not be null");
-
- if (this === @undefined)
- throw new @TypeError("String.prototype.padStart requires that |this| not be undefined");
+ if (this == null)
+ throw new @TypeError("String.prototype.padStart requires that |this| not be null or undefined");
var string = @toString(this);
maxLength = @toLength(maxLength);
@@ -170,11 +160,8 @@
{
"use strict";
- if (this === null)
- throw new @TypeError("String.prototype.padEnd requires that |this| not be null");
-
- if (this === @undefined)
- throw new @TypeError("String.prototype.padEnd requires that |this| not be undefined");
+ if (this == null)
+ throw new @TypeError("String.prototype.padEnd requires that |this| not be null or undefined");
var string = @toString(this);
maxLength = @toLength(maxLength);
@@ -231,11 +218,8 @@
{
"use strict";
- if (this == null) {
- if (this === null)
- throw new @TypeError("String.prototype.replace requires that |this| not be null");
- throw new @TypeError("String.prototype.replace requires that |this| not be undefined");
- }
+ if (this == null)
+ throw new @TypeError("String.prototype.replace requires that |this| not be null or undefined");
if (search != null) {
let replacer = search.@replaceSymbol;
@@ -259,11 +243,8 @@
// http://ecma-international.org/publications/standards/Ecma-402.htm
// 1. Let O be RequireObjectCoercible(this value).
- if (this === null)
- throw new @TypeError("String.prototype.localeCompare requires that |this| not be null");
-
- if (this === @undefined)
- throw new @TypeError("String.prototype.localeCompare requires that |this| not be undefined");
+ if (this == null)
+ throw new @TypeError("String.prototype.localeCompare requires that |this| not be null or undefined");
// 2. Let S be ToString(O).
// 3. ReturnIfAbrupt(S).
@@ -289,11 +270,8 @@
{
"use strict";
- if (this == null) {
- if (this === null)
- throw new @TypeError("String.prototype.search requires that |this| not be null");
- throw new @TypeError("String.prototype.search requires that |this| not be undefined");
- }
+ if (this == null)
+ throw new @TypeError("String.prototype.search requires that |this| not be null or undefined");
if (regexp != null) {
var searcher = regexp.@searchSymbol;
@@ -310,11 +288,8 @@
{
"use strict";
- if (this == null) {
- if (this === null)
- throw new @TypeError("String.prototype.split requires that |this| not be null");
- throw new @TypeError("String.prototype.split requires that |this| not be undefined");
- }
+ if (this == null)
+ throw new @TypeError("String.prototype.split requires that |this| not be null or undefined");
if (separator != null) {
var splitter = separator.@splitSymbol;
Modified: trunk/Source/_javascript_Core/tests/es6/String.prototype_methods_String.prototype.padEnd.js (203392 => 203393)
--- trunk/Source/_javascript_Core/tests/es6/String.prototype_methods_String.prototype.padEnd.js 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/Source/_javascript_Core/tests/es6/String.prototype_methods_String.prototype.padEnd.js 2016-07-19 02:45:35 UTC (rev 203393)
@@ -41,8 +41,8 @@
(function TestRequireObjectCoercible() {
var padEnd = String.prototype.padEnd;
- shouldThrow(() => padEnd.call(null, 4, "test"), "TypeError: String.prototype.padEnd requires that |this| not be null");
- shouldThrow(() => padEnd.call(undefined, 4, "test"), "TypeError: String.prototype.padEnd requires that |this| not be undefined");
+ shouldThrow(() => padEnd.call(null, 4, "test"), "TypeError: String.prototype.padEnd requires that |this| not be null or undefined");
+ shouldThrow(() => padEnd.call(undefined, 4, "test"), "TypeError: String.prototype.padEnd requires that |this| not be null or undefined");
shouldBe("123 ", padEnd.call({
__proto__: null,
valueOf() { return 123; }
Modified: trunk/Source/_javascript_Core/tests/es6/String.prototype_methods_String.prototype.padStart.js (203392 => 203393)
--- trunk/Source/_javascript_Core/tests/es6/String.prototype_methods_String.prototype.padStart.js 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/Source/_javascript_Core/tests/es6/String.prototype_methods_String.prototype.padStart.js 2016-07-19 02:45:35 UTC (rev 203393)
@@ -41,8 +41,8 @@
(function TestRequireObjectCoercible() {
var padStart = String.prototype.padStart;
- shouldThrow(() => padStart.call(null, 4, "test"), "TypeError: String.prototype.padStart requires that |this| not be null");
- shouldThrow(() => padStart.call(undefined, 4, "test"), "TypeError: String.prototype.padStart requires that |this| not be undefined");
+ shouldThrow(() => padStart.call(null, 4, "test"), "TypeError: String.prototype.padStart requires that |this| not be null or undefined");
+ shouldThrow(() => padStart.call(undefined, 4, "test"), "TypeError: String.prototype.padStart requires that |this| not be null or undefined");
shouldBe(" 123", padStart.call({
__proto__: null,
valueOf() { return 123; }
Modified: trunk/Source/_javascript_Core/tests/stress/array-iterators-next-error-messages.js (203392 => 203393)
--- trunk/Source/_javascript_Core/tests/stress/array-iterators-next-error-messages.js 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/Source/_javascript_Core/tests/stress/array-iterators-next-error-messages.js 2016-07-19 02:45:35 UTC (rev 203393)
@@ -8,11 +8,11 @@
try {
next.call(null);
} catch(e) {
- assert(e, "TypeError: %ArrayIteratorPrototype%.next requires that |this| not be null");
+ assert(e, "TypeError: %ArrayIteratorPrototype%.next requires that |this| not be null or undefined");
}
try {
next.call(undefined);
} catch(e) {
- assert(e, "TypeError: %ArrayIteratorPrototype%.next requires that |this| not be undefined");
+ assert(e, "TypeError: %ArrayIteratorPrototype%.next requires that |this| not be null or undefined");
}
Modified: trunk/Source/_javascript_Core/tests/stress/array-iterators-next-with-call.js (203392 => 203393)
--- trunk/Source/_javascript_Core/tests/stress/array-iterators-next-with-call.js 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/Source/_javascript_Core/tests/stress/array-iterators-next-with-call.js 2016-07-19 02:45:35 UTC (rev 203393)
@@ -85,9 +85,9 @@
throw "Error: no error thrown";
var expectedMessage = 'TypeError: %ArrayIteratorPrototype%.next requires that |this| be an Array Iterator instance';
if (primitive === null)
- expectedMessage = 'TypeError: %ArrayIteratorPrototype%.next requires that |this| not be null';
+ expectedMessage = 'TypeError: %ArrayIteratorPrototype%.next requires that |this| not be null or undefined';
if (primitive === undefined)
- expectedMessage = 'TypeError: %ArrayIteratorPrototype%.next requires that |this| not be undefined';
+ expectedMessage = 'TypeError: %ArrayIteratorPrototype%.next requires that |this| not be null or undefined';
if (String(didThrow) !== expectedMessage)
throw "Error: bad error thrown: " + didThrow;
}
Modified: trunk/Source/_javascript_Core/tests/stress/regexp-match.js (203392 => 203393)
--- trunk/Source/_javascript_Core/tests/stress/regexp-match.js 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/Source/_javascript_Core/tests/stress/regexp-match.js 2016-07-19 02:45:35 UTC (rev 203393)
@@ -25,11 +25,11 @@
shouldThrow(function () {
String.prototype.match.call(null, /Cocoa/);
-}, "TypeError: String.prototype.match requires that |this| not be null");
+}, "TypeError: String.prototype.match requires that |this| not be null or undefined");
shouldThrow(function () {
String.prototype.match.call(undefined, /Cocoa/);
-}, "TypeError: String.prototype.match requires that |this| not be undefined");
+}, "TypeError: String.prototype.match requires that |this| not be null or undefined");
shouldThrow(function () {
string.match(errorKey);
Modified: trunk/Source/_javascript_Core/tests/stress/regexp-search.js (203392 => 203393)
--- trunk/Source/_javascript_Core/tests/stress/regexp-search.js 2016-07-19 02:02:37 UTC (rev 203392)
+++ trunk/Source/_javascript_Core/tests/stress/regexp-search.js 2016-07-19 02:45:35 UTC (rev 203393)
@@ -25,11 +25,11 @@
shouldThrow(function () {
String.prototype.search.call(null, /Cocoa/);
-}, "TypeError: String.prototype.search requires that |this| not be null");
+}, "TypeError: String.prototype.search requires that |this| not be null or undefined");
shouldThrow(function () {
String.prototype.search.call(undefined, /Cocoa/);
-}, "TypeError: String.prototype.search requires that |this| not be undefined");
+}, "TypeError: String.prototype.search requires that |this| not be null or undefined");
shouldThrow(function () {
string.search(errorKey);