Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (279768 => 279769)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-07-09 00:38:41 UTC (rev 279769)
@@ -1,3 +1,25 @@
+2021-07-08 Yusuke Suzuki <ysuz...@apple.com>
+
+ Fix StructuredClone for streams to handle BigInt64Array / BigUint64Array
+ https://bugs.webkit.org/show_bug.cgi?id=227571
+
+ Reviewed by Chris Dumez.
+
+ * resources/import-expectations.json:
+ * web-platform-tests/FileAPI/blob/Blob-constructor.any-expected.txt:
+ * web-platform-tests/FileAPI/blob/Blob-constructor.any.js:
+ (test_blob):
+ * web-platform-tests/FileAPI/blob/Blob-constructor.any.worker-expected.txt:
+ * web-platform-tests/encoding/encodeInto.any-expected.txt:
+ * web-platform-tests/encoding/encodeInto.any.js:
+ (string_appeared_here.forEach.type.string_appeared_here.forEach):
+ (Float64Array.forEach.view.string_appeared_here.forEach): Deleted.
+ * web-platform-tests/encoding/encodeInto.any.worker-expected.txt:
+ * web-platform-tests/encoding/w3c-import.log:
+ * web-platform-tests/fetch/api/response/response-clone.any-expected.txt:
+ * web-platform-tests/fetch/api/response/response-clone.any.js:
+ * web-platform-tests/fetch/api/response/response-clone.any.worker-expected.txt:
+
2021-07-08 Chris Dumez <cdu...@apple.com>
[IndexedDB] KeyPath validity checks should happen on the cloned value, not the original one
Modified: trunk/LayoutTests/imported/w3c/resources/import-expectations.json (279768 => 279769)
--- trunk/LayoutTests/imported/w3c/resources/import-expectations.json 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/LayoutTests/imported/w3c/resources/import-expectations.json 2021-07-09 00:38:41 UTC (rev 279769)
@@ -34,6 +34,7 @@
"web-platform-tests/DOM-parsing": "skip",
"web-platform-tests/DOMEvents": "skip",
"web-platform-tests/FileAPI": "import",
+ "web-platform-tests/FileAPI/blob": "import",
"web-platform-tests/IndexedDB": "import",
"web-platform-tests/WebCryptoAPI": "import",
"web-platform-tests/WebIDL": "import",
@@ -208,6 +209,7 @@
"web-platform-tests/fetch/api/cors": "import",
"web-platform-tests/fetch/api/redirect": "import",
"web-platform-tests/fetch/api/resources": "import",
+ "web-platform-tests/fetch/api/response": "import",
"web-platform-tests/fetch/origin": "import",
"web-platform-tests/fetch/range": "import",
"web-platform-tests/fetch/stale-while-revalidate": "import",
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-constructor.any-expected.txt (279768 => 279769)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-constructor.any-expected.txt 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-constructor.any-expected.txt 2021-07-09 00:38:41 UTC (rev 279769)
@@ -20,6 +20,7 @@
PASS ArrayBuffer elements of the blobParts array should be supported.
PASS Passing typed arrays as elements of the blobParts array should work.
PASS Passing a Float64Array as element of the blobParts array should work.
+PASS Passing BigInt typed arrays as elements of the blobParts array should work.
PASS Passing a FrozenArray as the blobParts array should work (FrozenArray<MessagePort>).
PASS Array with two blobs
PASS Array with two buffers
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-constructor.any.js (279768 => 279769)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-constructor.any.js 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-constructor.any.js 2021-07-09 00:38:41 UTC (rev 279769)
@@ -311,8 +311,17 @@
desc: "Passing a Float64Array as element of the blobParts array should work."
});
+test_blob(function() {
+ return new Blob([
+ new BigInt64Array([BigInt("0x5353415053534150")]),
+ new BigUint64Array([BigInt("0x5353415053534150")])
+ ]);
+}, {
+ expected: "PASSPASSPASSPASS",
+ type: "",
+ desc: "Passing BigInt typed arrays as elements of the blobParts array should work."
+});
-
var t_ports = async_test("Passing a FrozenArray as the blobParts array should work (FrozenArray<MessagePort>).");
t_ports.step(function() {
var channel = new MessageChannel();
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-constructor.any.worker-expected.txt (279768 => 279769)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-constructor.any.worker-expected.txt 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-constructor.any.worker-expected.txt 2021-07-09 00:38:41 UTC (rev 279769)
@@ -20,6 +20,7 @@
PASS ArrayBuffer elements of the blobParts array should be supported.
PASS Passing typed arrays as elements of the blobParts array should work.
PASS Passing a Float64Array as element of the blobParts array should work.
+PASS Passing BigInt typed arrays as elements of the blobParts array should work.
PASS Passing a FrozenArray as the blobParts array should work (FrozenArray<MessagePort>).
PASS Array with two blobs
PASS Array with two buffers
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/encodeInto.any-expected.txt (279768 => 279769)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/encodeInto.any-expected.txt 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/encodeInto.any-expected.txt 2021-07-09 00:38:41 UTC (rev 279769)
@@ -97,6 +97,10 @@
PASS Invalid encodeInto() destination: Uint32Array, backed by: SharedArrayBuffer
PASS Invalid encodeInto() destination: Uint8ClampedArray, backed by: ArrayBuffer
PASS Invalid encodeInto() destination: Uint8ClampedArray, backed by: SharedArrayBuffer
+PASS Invalid encodeInto() destination: BigInt64Array, backed by: ArrayBuffer
+PASS Invalid encodeInto() destination: BigInt64Array, backed by: SharedArrayBuffer
+PASS Invalid encodeInto() destination: BigUint64Array, backed by: ArrayBuffer
+PASS Invalid encodeInto() destination: BigUint64Array, backed by: SharedArrayBuffer
PASS Invalid encodeInto() destination: Float32Array, backed by: ArrayBuffer
PASS Invalid encodeInto() destination: Float32Array, backed by: SharedArrayBuffer
PASS Invalid encodeInto() destination: Float64Array, backed by: ArrayBuffer
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/encodeInto.any.js (279768 => 279769)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/encodeInto.any.js 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/encodeInto.any.js 2021-07-09 00:38:41 UTC (rev 279769)
@@ -120,19 +120,22 @@
});
});
-[DataView,
- Int8Array,
- Int16Array,
- Int32Array,
- Uint16Array,
- Uint32Array,
- Uint8ClampedArray,
- Float32Array,
- Float64Array].forEach(view => {
+["DataView",
+ "Int8Array",
+ "Int16Array",
+ "Int32Array",
+ "Uint16Array",
+ "Uint32Array",
+ "Uint8ClampedArray",
+ "BigInt64Array",
+ "BigUint64Array",
+ "Float32Array",
+ "Float64Array"].forEach(type => {
["ArrayBuffer", "SharedArrayBuffer"].forEach((arrayBufferOrSharedArrayBuffer) => {
test(() => {
- assert_throws_js(TypeError, () => new TextEncoder().encodeInto("", new view(createBuffer(arrayBufferOrSharedArrayBuffer, 0))));
- }, "Invalid encodeInto() destination: " + view.name + ", backed by: " + arrayBufferOrSharedArrayBuffer);
+ const viewInstance = new self[type](createBuffer(arrayBufferOrSharedArrayBuffer, 0));
+ assert_throws_js(TypeError, () => new TextEncoder().encodeInto("", viewInstance));
+ }, "Invalid encodeInto() destination: " + type + ", backed by: " + arrayBufferOrSharedArrayBuffer);
});
});
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/encodeInto.any.worker-expected.txt (279768 => 279769)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/encodeInto.any.worker-expected.txt 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/encodeInto.any.worker-expected.txt 2021-07-09 00:38:41 UTC (rev 279769)
@@ -97,6 +97,10 @@
PASS Invalid encodeInto() destination: Uint32Array, backed by: SharedArrayBuffer
PASS Invalid encodeInto() destination: Uint8ClampedArray, backed by: ArrayBuffer
PASS Invalid encodeInto() destination: Uint8ClampedArray, backed by: SharedArrayBuffer
+PASS Invalid encodeInto() destination: BigInt64Array, backed by: ArrayBuffer
+PASS Invalid encodeInto() destination: BigInt64Array, backed by: SharedArrayBuffer
+PASS Invalid encodeInto() destination: BigUint64Array, backed by: ArrayBuffer
+PASS Invalid encodeInto() destination: BigUint64Array, backed by: SharedArrayBuffer
PASS Invalid encodeInto() destination: Float32Array, backed by: ArrayBuffer
PASS Invalid encodeInto() destination: Float32Array, backed by: SharedArrayBuffer
PASS Invalid encodeInto() destination: Float64Array, backed by: ArrayBuffer
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/w3c-import.log (279768 => 279769)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/w3c-import.log 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/encoding/w3c-import.log 2021-07-09 00:38:41 UTC (rev 279769)
@@ -23,6 +23,7 @@
/LayoutTests/imported/w3c/web-platform-tests/encoding/bom-handling.html
/LayoutTests/imported/w3c/web-platform-tests/encoding/bom-handling.html.headers
/LayoutTests/imported/w3c/web-platform-tests/encoding/encodeInto.any.js
+/LayoutTests/imported/w3c/web-platform-tests/encoding/eof-shift_jis-expected.html
/LayoutTests/imported/w3c/web-platform-tests/encoding/eof-shift_jis.html
/LayoutTests/imported/w3c/web-platform-tests/encoding/eof-utf-8-one-expected.html
/LayoutTests/imported/w3c/web-platform-tests/encoding/eof-utf-8-one.html
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.any-expected.txt (279768 => 279769)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.any-expected.txt 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.any-expected.txt 2021-07-09 00:38:41 UTC (rev 279769)
@@ -14,6 +14,8 @@
PASS Check response clone use structureClone for teed ReadableStreams (Uint8ClampedArraychunk)
PASS Check response clone use structureClone for teed ReadableStreams (Uint16Arraychunk)
PASS Check response clone use structureClone for teed ReadableStreams (Uint32Arraychunk)
+PASS Check response clone use structureClone for teed ReadableStreams (BigInt64Arraychunk)
+PASS Check response clone use structureClone for teed ReadableStreams (BigUint64Arraychunk)
PASS Check response clone use structureClone for teed ReadableStreams (Float32Arraychunk)
PASS Check response clone use structureClone for teed ReadableStreams (Float64Arraychunk)
FAIL Check response clone use structureClone for teed ReadableStreams (DataViewchunk) assert_array_equals: Cloned buffer chunks have the same content value is object "[object DataView]", expected array
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.any.js (279768 => 279769)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.any.js 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.any.js 2021-07-09 00:38:41 UTC (rev 279769)
@@ -119,6 +119,8 @@
testReadableStreamClone(new Uint8ClampedArray(arrayBuffer), "Uint8ClampedArray");
testReadableStreamClone(new Uint16Array(arrayBuffer, 2), "Uint16Array");
testReadableStreamClone(new Uint32Array(arrayBuffer), "Uint32Array");
+testReadableStreamClone(typeof BigInt64Array === "function" ? new BigInt64Array(arrayBuffer) : undefined, "BigInt64Array");
+testReadableStreamClone(typeof BigUint64Array === "function" ? new BigUint64Array(arrayBuffer) : undefined, "BigUint64Array");
testReadableStreamClone(new Float32Array(arrayBuffer), "Float32Array");
testReadableStreamClone(new Float64Array(arrayBuffer), "Float64Array");
testReadableStreamClone(new DataView(arrayBuffer, 2, 8), "DataView");
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.any.worker-expected.txt (279768 => 279769)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.any.worker-expected.txt 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-clone.any.worker-expected.txt 2021-07-09 00:38:41 UTC (rev 279769)
@@ -14,6 +14,8 @@
PASS Check response clone use structureClone for teed ReadableStreams (Uint8ClampedArraychunk)
PASS Check response clone use structureClone for teed ReadableStreams (Uint16Arraychunk)
PASS Check response clone use structureClone for teed ReadableStreams (Uint32Arraychunk)
+PASS Check response clone use structureClone for teed ReadableStreams (BigInt64Arraychunk)
+PASS Check response clone use structureClone for teed ReadableStreams (BigUint64Arraychunk)
PASS Check response clone use structureClone for teed ReadableStreams (Float32Arraychunk)
PASS Check response clone use structureClone for teed ReadableStreams (Float64Arraychunk)
FAIL Check response clone use structureClone for teed ReadableStreams (DataViewchunk) assert_array_equals: Cloned buffer chunks have the same content value is object "[object DataView]", expected array
Modified: trunk/Source/WebCore/ChangeLog (279768 => 279769)
--- trunk/Source/WebCore/ChangeLog 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/Source/WebCore/ChangeLog 2021-07-09 00:38:41 UTC (rev 279769)
@@ -1,3 +1,26 @@
+2021-07-08 Yusuke Suzuki <ysuz...@apple.com>
+
+ Fix StructuredClone for streams to handle BigInt64Array / BigUint64Array
+ https://bugs.webkit.org/show_bug.cgi?id=227571
+
+ Reviewed by Chris Dumez.
+
+ While we already support BigInt64Array / BigUint64Array handling even in DOM code,
+ we lack support of them only in fetch's structuredClone code (which is specialized one
+ to make it fast by bypassing serialization / deserialization).
+
+ This patch fixes the issue to complete BigInt64Array / BigUint64Array in all DOM code.
+
+ * Modules/streams/ReadableStreamInternals.js:
+ (readableStreamTeePullFunction):
+ (doStructuredClone): Deleted.
+ * bindings/js/JSDOMGlobalObject.cpp:
+ (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
+ * bindings/js/StructuredClone.cpp:
+ (WebCore::JSC_DEFINE_HOST_FUNCTION):
+ * bindings/js/StructuredClone.h:
+ * bindings/js/WebCoreBuiltinNames.h:
+
2021-07-08 Chris Dumez <cdu...@apple.com>
Make sure SVG SMIL animations do not run in processes without any pages
Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js (279768 => 279769)
--- trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js 2021-07-09 00:38:41 UTC (rev 279769)
@@ -435,22 +435,6 @@
return [branch1, branch2];
}
-function doStructuredClone(object)
-{
- "use strict";
-
- // FIXME: We should implement http://w3c.github.io/html/infrastructure.html#ref-for-structured-clone-4
- // Implementation is currently limited to ArrayBuffer/ArrayBufferView to meet Fetch API needs.
-
- if (object instanceof @ArrayBuffer)
- return @structuredCloneArrayBuffer(object);
-
- if (@ArrayBuffer.@isView(object))
- return @structuredCloneArrayBufferView(object);
-
- @throwTypeError("structuredClone not implemented for: " + object);
-}
-
function readableStreamTeePullFunction(teeState, reader, shouldClone)
{
"use strict";
@@ -473,7 +457,7 @@
if (!teeState.canceled1)
@readableStreamDefaultControllerEnqueue(teeState.branch1.@readableStreamController, result.value);
if (!teeState.canceled2)
- @readableStreamDefaultControllerEnqueue(teeState.branch2.@readableStreamController, shouldClone ? @doStructuredClone(result.value) : result.value);
+ @readableStreamDefaultControllerEnqueue(teeState.branch2.@readableStreamController, shouldClone ? @structuredCloneForStream(result.value) : result.value);
});
}
}
Modified: trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp (279768 => 279769)
--- trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp 2021-07-09 00:38:41 UTC (rev 279769)
@@ -195,10 +195,8 @@
JSFunction::create(vm, this, 2, String(), whenSignalAborted), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
JSDOMGlobalObject::GlobalPropertyInfo(clientData.builtinNames().cloneArrayBufferPrivateName(),
JSFunction::create(vm, this, 3, String(), cloneArrayBuffer), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
- JSDOMGlobalObject::GlobalPropertyInfo(clientData.builtinNames().structuredCloneArrayBufferPrivateName(),
- JSFunction::create(vm, this, 1, String(), structuredCloneArrayBuffer), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
- JSDOMGlobalObject::GlobalPropertyInfo(clientData.builtinNames().structuredCloneArrayBufferViewPrivateName(),
- JSFunction::create(vm, this, 1, String(), structuredCloneArrayBufferView), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
+ JSDOMGlobalObject::GlobalPropertyInfo(clientData.builtinNames().structuredCloneForStreamPrivateName(),
+ JSFunction::create(vm, this, 1, String(), structuredCloneForStream), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
JSDOMGlobalObject::GlobalPropertyInfo(vm.propertyNames->builtinNames().ArrayBufferPrivateName(), arrayBufferConstructor(), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
JSDOMGlobalObject::GlobalPropertyInfo(clientData.builtinNames().streamClosedPrivateName(), jsNumber(1), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
JSDOMGlobalObject::GlobalPropertyInfo(clientData.builtinNames().streamClosingPrivateName(), jsNumber(2), PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
Modified: trunk/Source/WebCore/bindings/js/StructuredClone.cpp (279768 => 279769)
--- trunk/Source/WebCore/bindings/js/StructuredClone.cpp 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/Source/WebCore/bindings/js/StructuredClone.cpp 2021-07-09 00:38:41 UTC (rev 279769)
@@ -67,53 +67,47 @@
return cloneArrayBufferImpl(globalObject, callFrame, CloneMode::Partial);
}
-JSC_DEFINE_HOST_FUNCTION(structuredCloneArrayBuffer, (JSGlobalObject* globalObject, CallFrame* callFrame))
+JSC_DEFINE_HOST_FUNCTION(structuredCloneForStream, (JSGlobalObject* globalObject, CallFrame* callFrame))
{
- return cloneArrayBufferImpl(globalObject, callFrame, CloneMode::Full);
-}
-
-JSC_DEFINE_HOST_FUNCTION(structuredCloneArrayBufferView, (JSGlobalObject* globalObject, CallFrame* callFrame))
-{
ASSERT(callFrame);
ASSERT(callFrame->argumentCount());
- JSValue value = callFrame->uncheckedArgument(0);
VM& vm = globalObject->vm();
- auto* bufferView = jsDynamicCast<JSArrayBufferView*>(vm, value);
- ASSERT(bufferView);
+ auto scope = DECLARE_THROW_SCOPE(vm);
- auto* buffer = bufferView->unsharedBuffer();
- if (!buffer) {
- auto scope = DECLARE_THROW_SCOPE(vm);
- throwDataCloneError(*globalObject, scope);
- return { };
+ JSValue value = callFrame->uncheckedArgument(0);
+
+ if (value.inherits<JSArrayBuffer>(vm))
+ RELEASE_AND_RETURN(scope, cloneArrayBufferImpl(globalObject, callFrame, CloneMode::Full));
+
+ if (value.inherits<JSArrayBufferView>(vm)) {
+ auto* bufferView = jsCast<JSArrayBufferView*>(value);
+ ASSERT(bufferView);
+
+ auto* buffer = bufferView->unsharedBuffer();
+ if (!buffer) {
+ throwDataCloneError(*globalObject, scope);
+ return { };
+ }
+ auto bufferClone = ArrayBuffer::tryCreate(buffer->data(), buffer->byteLength());
+ Structure* structure = bufferView->structure(vm);
+
+#define CLONE_TYPED_ARRAY(name) \
+ do { \
+ if (bufferView->inherits<JS##name##Array>(vm)) \
+ RELEASE_AND_RETURN(scope, JSValue::encode(JS##name##Array::create(globalObject, structure, WTFMove(bufferClone), bufferView->byteOffset(), bufferView->length()))); \
+ } while (0);
+
+ FOR_EACH_TYPED_ARRAY_TYPE_EXCLUDING_DATA_VIEW(CLONE_TYPED_ARRAY)
+
+#undef CLONE_TYPED_ARRAY
+
+ if (value.inherits<JSDataView>(vm))
+ RELEASE_AND_RETURN(scope, JSValue::encode(JSDataView::create(globalObject, structure, WTFMove(bufferClone), bufferView->byteOffset(), bufferView->length())));
}
- auto bufferClone = ArrayBuffer::tryCreate(buffer->data(), buffer->byteLength());
- Structure* structure = bufferView->structure(vm);
- if (jsDynamicCast<JSInt8Array*>(vm, value))
- return JSValue::encode(JSInt8Array::create(globalObject, structure, WTFMove(bufferClone), bufferView->byteOffset(), bufferView->length()));
- if (jsDynamicCast<JSInt16Array*>(vm, value))
- return JSValue::encode(JSInt16Array::create(globalObject, structure, WTFMove(bufferClone), bufferView->byteOffset(), bufferView->length()));
- if (jsDynamicCast<JSInt32Array*>(vm, value))
- return JSValue::encode(JSInt32Array::create(globalObject, structure, WTFMove(bufferClone), bufferView->byteOffset(), bufferView->length()));
- if (jsDynamicCast<JSUint8Array*>(vm, value))
- return JSValue::encode(JSUint8Array::create(globalObject, structure, WTFMove(bufferClone), bufferView->byteOffset(), bufferView->length()));
- if (jsDynamicCast<JSUint8ClampedArray*>(vm, value))
- return JSValue::encode(JSUint8ClampedArray::create(globalObject, structure, WTFMove(bufferClone), bufferView->byteOffset(), bufferView->length()));
- if (jsDynamicCast<JSUint16Array*>(vm, value))
- return JSValue::encode(JSUint16Array::create(globalObject, structure, WTFMove(bufferClone), bufferView->byteOffset(), bufferView->length()));
- if (jsDynamicCast<JSUint32Array*>(vm, value))
- return JSValue::encode(JSUint32Array::create(globalObject, structure, WTFMove(bufferClone), bufferView->byteOffset(), bufferView->length()));
- if (jsDynamicCast<JSFloat32Array*>(vm, value))
- return JSValue::encode(JSFloat32Array::create(globalObject, structure, WTFMove(bufferClone), bufferView->byteOffset(), bufferView->length()));
- if (jsDynamicCast<JSFloat64Array*>(vm, value))
- return JSValue::encode(JSFloat64Array::create(globalObject, structure, WTFMove(bufferClone), bufferView->byteOffset(), bufferView->length()));
- if (jsDynamicCast<JSDataView*>(vm, value))
- return JSValue::encode(JSDataView::create(globalObject, structure, WTFMove(bufferClone), bufferView->byteOffset(), bufferView->length()));
-
- ASSERT_NOT_REACHED();
- return JSValue::encode(jsUndefined());
+ throwTypeError(globalObject, scope, "structuredClone not implemented for non-ArrayBuffer / non-ArrayBufferView"_s);
+ return { };
}
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/js/StructuredClone.h (279768 => 279769)
--- trunk/Source/WebCore/bindings/js/StructuredClone.h 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/Source/WebCore/bindings/js/StructuredClone.h 2021-07-09 00:38:41 UTC (rev 279769)
@@ -35,7 +35,6 @@
namespace WebCore {
JSC_DECLARE_HOST_FUNCTION(cloneArrayBuffer);
-JSC_DECLARE_HOST_FUNCTION(structuredCloneArrayBuffer);
-JSC_DECLARE_HOST_FUNCTION(structuredCloneArrayBufferView);
+JSC_DECLARE_HOST_FUNCTION(structuredCloneForStream);
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (279768 => 279769)
--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2021-07-09 00:12:30 UTC (rev 279768)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2021-07-09 00:38:41 UTC (rev 279769)
@@ -452,8 +452,7 @@
macro(streamReadable) \
macro(streamWaiting) \
macro(streamWritable) \
- macro(structuredCloneArrayBuffer) \
- macro(structuredCloneArrayBufferView) \
+ macro(structuredCloneForStream) \
macro(timeline) \
macro(top) \
macro(textDecoderStreamDecoder) \