Title: [218452] trunk
Revision
218452
Author
[email protected]
Date
2017-06-17 07:13:13 -0700 (Sat, 17 Jun 2017)

Log Message

ArrayBuffer constructor needs to create subclass structures before its buffer
https://bugs.webkit.org/show_bug.cgi?id=173510

Reviewed by Yusuke Suzuki.

JSTests:

* test262.yaml:

Source/_javascript_Core:

* runtime/JSArrayBufferConstructor.cpp:
(JSC::constructArrayBuffer):

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (218451 => 218452)


--- trunk/JSTests/ChangeLog	2017-06-17 13:02:08 UTC (rev 218451)
+++ trunk/JSTests/ChangeLog	2017-06-17 14:13:13 UTC (rev 218452)
@@ -1,5 +1,14 @@
 2017-06-17  Keith Miller  <[email protected]>
 
+        ArrayBuffer constructor needs to create subclass structures before its buffer
+        https://bugs.webkit.org/show_bug.cgi?id=173510
+
+        Reviewed by Yusuke Suzuki.
+
+        * test262.yaml:
+
+2017-06-17  Keith Miller  <[email protected]>
+
         ArrayPrototype methods should use JSValue::toLength for non-Arrays.
         https://bugs.webkit.org/show_bug.cgi?id=173506
 

Modified: trunk/JSTests/test262.yaml (218451 => 218452)


--- trunk/JSTests/test262.yaml	2017-06-17 13:02:08 UTC (rev 218451)
+++ trunk/JSTests/test262.yaml	2017-06-17 14:13:13 UTC (rev 218452)
@@ -12890,9 +12890,9 @@
 - path: test262/test/built-ins/ArrayBuffer/allocation-limit.js
   cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js"], [:strict]
 - path: test262/test/built-ins/ArrayBuffer/data-allocation-after-object-creation.js
-  cmd: runTest262 :fail, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js"], []
+  cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js"], []
 - path: test262/test/built-ins/ArrayBuffer/data-allocation-after-object-creation.js
-  cmd: runTest262 :fail, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js"], [:strict]
+  cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js"], [:strict]
 - path: test262/test/built-ins/ArrayBuffer/init-zero.js
   cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js"], []
 - path: test262/test/built-ins/ArrayBuffer/init-zero.js

Modified: trunk/Source/_javascript_Core/ChangeLog (218451 => 218452)


--- trunk/Source/_javascript_Core/ChangeLog	2017-06-17 13:02:08 UTC (rev 218451)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-06-17 14:13:13 UTC (rev 218452)
@@ -1,5 +1,15 @@
 2017-06-17  Keith Miller  <[email protected]>
 
+        ArrayBuffer constructor needs to create subclass structures before its buffer
+        https://bugs.webkit.org/show_bug.cgi?id=173510
+
+        Reviewed by Yusuke Suzuki.
+
+        * runtime/JSArrayBufferConstructor.cpp:
+        (JSC::constructArrayBuffer):
+
+2017-06-17  Keith Miller  <[email protected]>
+
         ArrayPrototype methods should use JSValue::toLength for non-Arrays.
         https://bugs.webkit.org/show_bug.cgi?id=173506
 

Modified: trunk/Source/_javascript_Core/runtime/JSArrayBufferConstructor.cpp (218451 => 218452)


--- trunk/Source/_javascript_Core/runtime/JSArrayBufferConstructor.cpp	2017-06-17 13:02:08 UTC (rev 218451)
+++ trunk/Source/_javascript_Core/runtime/JSArrayBufferConstructor.cpp	2017-06-17 14:13:13 UTC (rev 218452)
@@ -87,7 +87,10 @@
 
     JSArrayBufferConstructor* constructor =
         jsCast<JSArrayBufferConstructor*>(exec->jsCallee());
-    
+
+    Structure* arrayBufferStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), constructor->globalObject()->arrayBufferStructure(constructor->sharingMode()));
+    RETURN_IF_EXCEPTION(scope, { });
+
     unsigned length;
     if (exec->argumentCount()) {
         length = exec->uncheckedArgument(0).toIndex(exec, "length");
@@ -98,7 +101,7 @@
         // with a zero length.
         length = 0;
     }
-    
+
     auto buffer = ArrayBuffer::tryCreate(length, 1);
     if (!buffer)
         return JSValue::encode(throwOutOfMemoryError(exec, scope));
@@ -105,13 +108,9 @@
     
     if (constructor->sharingMode() == ArrayBufferSharingMode::Shared)
         buffer->makeShared();
-    
     ASSERT(constructor->sharingMode() == buffer->sharingMode());
-    
-    Structure* arrayBufferStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), constructor->globalObject()->arrayBufferStructure(constructor->sharingMode()));
-    RETURN_IF_EXCEPTION(scope, encodedJSValue());
+
     JSArrayBuffer* result = JSArrayBuffer::create(vm, arrayBufferStructure, WTFMove(buffer));
-    
     return JSValue::encode(result);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to