[Fetch API] Response cloning should structureClone when teeing Response stream
https://bugs.webkit.org/show_bug.cgi?id=161147
Patch by Youenn Fablet <youenn@apple.com> on 2016-08-29
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
* web-platform-tests/fetch/api/response/response-clone-expected.txt:
* web-platform-tests/fetch/api/response/response-clone.html:
Source/JavaScriptCore:
* builtins/BuiltinNames.h: Adding ArrayBuffer and isView identifiers.
* runtime/JSArrayBufferConstructor.cpp:
(JSC::JSArrayBufferConstructor::finishCreation): Adding @isView as private method.
* runtime/JSDataView.h: Exporting create method.
Source/WebCore:
Covered by updated test.
Implementing structure cloning for ArrayBuffer and ArrayBufferView objects.
Using this structure cloning in ReadableStream to support structureClone in the case of Fetch API.
* CMakeLists.txt: Adding StructureClone.cpp
* Modules/fetch/FetchResponse.js:
(clone): Setting structureClone to true
* Modules/streams/ReadableStreamInternals.js:
(doStructuredClone): Added to clone ArrayBuffer/ArrayBufferView chunks. Throwing exception otherwise.
(teeReadableStreamPullFunction): Using @doStructuredClone
* WebCore.xcodeproj/project.pbxproj: Adding StructureClone.cpp/.h
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::addBuiltinGlobals): Adding @ArrayBuffer and structuredCloneArrayBuffer and structuredCloneArrayBufferView private properties.
* bindings/js/StructuredClone.cpp: Added.
(WebCore::structuredCloneArrayBuffer): Cloning of ArrayBuffer as per
http://w3c.github.io/html/infrastructure.html#section-structuredclone step 11.
(WebCore::structuredCloneArrayBufferView): Cloning of ArrayBufferView as
perhttp://w3c.github.io/html/infrastructure.html#section-structuredclone, step 12.
* bindings/js/StructuredClone.h: Added.
* bindings/js/WebCoreBuiltinNames.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@205117 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed