Title: [198713] trunk/Source/_javascript_Core
Revision
198713
Author
[email protected]
Date
2016-03-25 23:51:11 -0700 (Fri, 25 Mar 2016)

Log Message

Misc. _javascript_Core built-ins cleanups
https://bugs.webkit.org/show_bug.cgi?id=155920

Patch by Joseph Pecoraro <[email protected]> on 2016-03-25
Reviewed by Mark Lam.

* builtins/RegExpPrototype.js:
(match):
No need for an else after an if that always returns.

* builtins/TypedArrayConstructor.js:
(of):
Fix error message to use the correct function name.

(allocateInt8Array):
(allocateInt16Array):
(allocateInt32Array):
(allocateUint32Array):
(allocateUint16Array):
(allocateUint8Array):
(allocateUint8ClampedArray):
(allocateFloat32Array):
(allocateFloat64Array):
Cleanup style to be like all the other code.

* tests/stress/typedarray-of.js:
Test the exception message.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (198712 => 198713)


--- trunk/Source/_javascript_Core/ChangeLog	2016-03-26 05:36:14 UTC (rev 198712)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-03-26 06:51:11 UTC (rev 198713)
@@ -1,5 +1,34 @@
 2016-03-25  Joseph Pecoraro  <[email protected]>
 
+        Misc. _javascript_Core built-ins cleanups
+        https://bugs.webkit.org/show_bug.cgi?id=155920
+
+        Reviewed by Mark Lam.
+
+        * builtins/RegExpPrototype.js:
+        (match):
+        No need for an else after an if that always returns.
+
+        * builtins/TypedArrayConstructor.js:
+        (of):
+        Fix error message to use the correct function name.
+
+        (allocateInt8Array):
+        (allocateInt16Array):
+        (allocateInt32Array):
+        (allocateUint32Array):
+        (allocateUint16Array):
+        (allocateUint8Array):
+        (allocateUint8ClampedArray):
+        (allocateFloat32Array):
+        (allocateFloat64Array):
+        Cleanup style to be like all the other code.
+
+        * tests/stress/typedarray-of.js:
+        Test the exception message.
+
+2016-03-25  Joseph Pecoraro  <[email protected]>
+
         Date.prototype.toLocaleDateString uses overridable Object.create
         https://bugs.webkit.org/show_bug.cgi?id=155917
 

Modified: trunk/Source/_javascript_Core/builtins/RegExpPrototype.js (198712 => 198713)


--- trunk/Source/_javascript_Core/builtins/RegExpPrototype.js	2016-03-26 05:36:14 UTC (rev 198712)
+++ trunk/Source/_javascript_Core/builtins/RegExpPrototype.js	2016-03-26 06:51:11 UTC (rev 198713)
@@ -72,7 +72,9 @@
                 if (resultList.length === 0)
                     return null;
                 return resultList;
-            } else if (!@isObject(result))
+            }
+
+            if (!@isObject(result))
                 throw new @TypeError("RegExp.prototype.@@match call to RegExp.exec didn't return null or an object");
 
             let resultString = @toString(result[0]);

Modified: trunk/Source/_javascript_Core/builtins/TypedArrayConstructor.js (198712 => 198713)


--- trunk/Source/_javascript_Core/builtins/TypedArrayConstructor.js	2016-03-26 05:36:14 UTC (rev 198712)
+++ trunk/Source/_javascript_Core/builtins/TypedArrayConstructor.js	2016-03-26 06:51:11 UTC (rev 198713)
@@ -34,7 +34,7 @@
     let len = arguments.length;
     let constructFunction = this.@allocateTypedArray;
     if (constructFunction === @undefined)
-        throw new @TypeError("TypedArray.from requires its this argument to subclass a TypedArray constructor");
+        throw new @TypeError("TypedArray.of requires its this argument to subclass a TypedArray constructor");
 
     let result = constructFunction(len);
 
@@ -126,56 +126,47 @@
     return result;
 }
 
-function allocateInt8Array(length) {
-
+function allocateInt8Array(length)
+{
     return new @Int8Array(length);
-
 }
 
-function allocateInt16Array(length) {
-
-    return new @Int16Array(length);
-    
+function allocateInt16Array(length)
+{
+    return new @Int16Array(length);    
 }
 
-function allocateInt32Array(length) {
-
-    return new @Int32Array(length);
-    
+function allocateInt32Array(length)
+{
+    return new @Int32Array(length);   
 }
 
-function allocateUint32Array(length) {
-
+function allocateUint32Array(length)
+{
     return new @Uint32Array(length);
-
 }
 
-function allocateUint16Array(length) {
-
-    return new @Uint16Array(length);
-    
+function allocateUint16Array(length)
+{
+    return new @Uint16Array(length);   
 }
 
-function allocateUint8Array(length) {
-
-    return new @Uint8Array(length);
-    
+function allocateUint8Array(length)
+{
+    return new @Uint8Array(length);   
 }
 
-function allocateUint8ClampedArray(length) {
-
+function allocateUint8ClampedArray(length)
+{
     return new @Uint8ClampedArray(length);
-
 }
 
-function allocateFloat32Array(length) {
-
+function allocateFloat32Array(length)
+{
     return new @Float32Array(length);
-
 }
 
-function allocateFloat64Array(length) {
-
+function allocateFloat64Array(length)
+{
     return new @Float64Array(length);
-
 }

Modified: trunk/Source/_javascript_Core/tests/stress/typedarray-of.js (198712 => 198713)


--- trunk/Source/_javascript_Core/tests/stress/typedarray-of.js	2016-03-26 05:36:14 UTC (rev 198712)
+++ trunk/Source/_javascript_Core/tests/stress/typedarray-of.js	2016-03-26 06:51:11 UTC (rev 198713)
@@ -13,4 +13,9 @@
 shouldBeTrue("testConstructorFunction('of', '()', [])");
 shouldBeTrue("testConstructorFunction('of', '(1)', [1])");
 shouldBeTrue("testConstructorFunction('of', '(1,2,3)', [1,2,3])");
+
+shouldThrow("testConstructorFunction('of', '.call(false)', false)", "'TypeError: TypedArray.of requires its this argument to subclass a TypedArray constructor'");
+shouldThrow("testConstructorFunction('of', '.call({})', false)", "'TypeError: TypedArray.of requires its this argument to subclass a TypedArray constructor'");
+shouldThrow("testConstructorFunction('of', '.call([])', false)", "'TypeError: TypedArray.of requires its this argument to subclass a TypedArray constructor'");
+
 finishJSTest();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to