Changeset 203632 in webkit
- Timestamp:
- Jul 22, 2016 11:01:15 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r203554 r203632 1149 1149 bindings/js/JSEventTargetCustom.cpp 1150 1150 bindings/js/JSExceptionBase.cpp 1151 bindings/js/JSFetchResponseCustom.cpp1152 1151 bindings/js/JSFileCustom.cpp 1153 1152 bindings/js/JSFileReaderCustom.cpp -
trunk/Source/WebCore/ChangeLog
r203631 r203632 1 2016-07-22 Youenn Fablet <youenn@apple.com> 2 3 Use a private property to implement FetchResponse.body getter 4 https://bugs.webkit.org/show_bug.cgi?id=159808 5 6 Reviewed by Sam Weinig. 7 8 Covered by existing test sets. 9 10 Previously, body was handled as a CachedAttribute. 11 Using a private property will allow direct use of this property from JS built-ins which will allow easier 12 handling of ReadableStream cloning in Response.clone. 13 Also, this allows removing some binding custom code. 14 15 Updated redirect and error static methods to take NewObject keyword, as this removes a search into cached wrappers. 16 Ditto for createReadableStreamSource. 17 18 * CMakeLists.txt: Removing JSFetchResponseCustom.cpp. 19 * Modules/fetch/FetchResponse.idl: Adding createReadableStreamSource and isDisturbed private functions. 20 Making body getter a JSBuiltin. 21 * Modules/fetch/FetchResponse.js: 22 (body): Adding getter which will call createReadableStreamSource if needed. 23 * WebCore.xcodeproj/project.pbxproj: Removing JSFetchResponseCustom.cpp. 24 * bindings/js/JSFetchResponseCustom.cpp: Removed. 25 * bindings/js/ReadableStreamController.cpp: 26 (WebCore::createReadableStream): Deleted. 27 (WebCore::getReadableStreamReader): Deleted. 28 * bindings/js/ReadableStreamController.h: Removing unneeded ReadableStream helper routine now that they can be 29 handled within JS built-in code. 30 * bindings/js/WebCoreBuiltinNames.h: Adding @createReadableStreamSource, @isDisturbed and @Response identifiers. 31 1 32 2016-07-22 Zalan Bujtas <zalan@apple.com> 2 33 -
trunk/Source/WebCore/Modules/fetch/FetchResponse.idl
r203445 r203632 35 35 Exposed=(Window,Worker), 36 36 InterfaceName=Response, 37 JSBuiltinConstructor 37 JSBuiltinConstructor, 38 PrivateIdentifier, 39 PublicIdentifier 38 40 ] 39 41 interface FetchResponse { 40 // FIXME: NewObject does not seem to be supported for static methods. 41 [CallWith=ScriptExecutionContext] static FetchResponse error(); 42 [CallWith=ScriptExecutionContext, RaisesException] static FetchResponse redirect(DOMString url, optional unsigned short status = 302); 42 [NewObject, CallWith=ScriptExecutionContext] static FetchResponse error(); 43 [NewObject, CallWith=ScriptExecutionContext, RaisesException] static FetchResponse redirect(DOMString url, optional unsigned short status = 302); 43 44 44 45 readonly attribute ResponseType type; … … 51 52 // FIXME: Add support for SameObject keyword for headers 52 53 readonly attribute FetchHeaders headers; 53 [ Custom, CachedAttribute] readonly attribute ReadableStream? body;54 [JSBuiltin] readonly attribute ReadableStream? body; 54 55 55 56 [NewObject, CallWith=ScriptExecutionContext, RaisesException] FetchResponse clone(); … … 57 58 [PrivateIdentifier, RaisesException] void setStatus(unsigned short status, DOMString statusText); 58 59 [CallWith=ScriptState, PrivateIdentifier] void initializeWith(any body); 60 [PrivateIdentifier, NewObject] ReadableStreamSource createReadableStreamSource(); 61 [PrivateIdentifier] boolean isDisturbed(); 59 62 }; 60 63 FetchResponse implements FetchBody; -
trunk/Source/WebCore/Modules/fetch/FetchResponse.js
r203445 r203632 54 54 return this; 55 55 } 56 57 function body() 58 { 59 if (!this.@body) { 60 if (@Response.prototype.@isDisturbed.@call(this)) { 61 this.@body = new @ReadableStream(); 62 // Get reader to lock it. 63 new @ReadableStreamReader(this.@body); 64 } else { 65 var source = @Response.prototype.@createReadableStreamSource.@call(this); 66 this.@body = source ? new @ReadableStream(source) : null; 67 } 68 } 69 return this.@body; 70 } -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r203553 r203632 1618 1618 418C39601C8F0AAE0051C8A3 /* JSReadableStreamSourceCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 418C395D1C8F0AAB0051C8A3 /* JSReadableStreamSourceCustom.cpp */; }; 1619 1619 418C39611C8F0AB10051C8A3 /* ReadableStreamController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 418C395E1C8F0AAB0051C8A3 /* ReadableStreamController.cpp */; }; 1620 418C39631C8F129B0051C8A3 /* JSFetchResponseCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 418C39621C8F12970051C8A3 /* JSFetchResponseCustom.cpp */; };1621 1620 418F88040FF957AE0080F045 /* JSAbstractWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 418F88020FF957AE0080F045 /* JSAbstractWorker.cpp */; }; 1622 1621 418F88050FF957AF0080F045 /* JSAbstractWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = 418F88030FF957AE0080F045 /* JSAbstractWorker.h */; }; … … 9199 9198 418C395E1C8F0AAB0051C8A3 /* ReadableStreamController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReadableStreamController.cpp; sourceTree = "<group>"; }; 9200 9199 418C395F1C8F0AAB0051C8A3 /* ReadableStreamController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamController.h; sourceTree = "<group>"; }; 9201 418C39621C8F12970051C8A3 /* JSFetchResponseCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFetchResponseCustom.cpp; sourceTree = "<group>"; };9202 9200 418F88020FF957AE0080F045 /* JSAbstractWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAbstractWorker.cpp; sourceTree = "<group>"; }; 9203 9201 418F88030FF957AE0080F045 /* JSAbstractWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAbstractWorker.h; sourceTree = "<group>"; }; … … 22563 22561 3314ACE910892086000F0E56 /* JSExceptionBase.cpp */, 22564 22562 3314ACEA10892086000F0E56 /* JSExceptionBase.h */, 22565 418C39621C8F12970051C8A3 /* JSFetchResponseCustom.cpp */,22566 22563 8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */, 22567 22564 8F934D831189F1EE00508D5D /* JSMainThreadExecState.h */, … … 30651 30648 7E4C96DC1AD4483500365A50 /* JSFetchRequest.cpp in Sources */, 30652 30649 8E4C96DC1AD4483500365A50 /* JSFetchResponse.cpp in Sources */, 30653 418C39631C8F129B0051C8A3 /* JSFetchResponseCustom.cpp in Sources */,30654 30650 BC00F0140E0A189500FD04E3 /* JSFile.cpp in Sources */, 30655 30651 516E54FA1CCB2EA80040D954 /* JSFileCustom.cpp in Sources */, -
trunk/Source/WebCore/bindings/js/ReadableStreamController.cpp
r202890 r203632 85 85 } 86 86 87 JSC::JSValue createReadableStream(JSC::ExecState& state, JSDOMGlobalObject* globalObject, ReadableStreamSource* source)88 {89 JSC::JSLockHolder lock(&state);90 91 auto jsSource = source ? toJS(&state, globalObject, *source) : JSC::jsUndefined();92 JSC::Strong<JSC::Unknown> protect(state.vm(), jsSource);93 94 JSC::MarkedArgumentBuffer arguments;95 arguments.append(jsSource);96 97 auto constructor = JSReadableStream::getConstructor(state.vm(), globalObject);98 99 JSC::ConstructData constructData;100 auto constructType = JSC::getConstructData(constructor, constructData);101 ASSERT(constructType != JSC::ConstructType::None);102 103 return construct(&state, constructor, constructType, constructData, arguments);104 }105 106 JSC::JSValue getReadableStreamReader(JSC::ExecState& state, JSC::JSValue readableStream)107 {108 ASSERT(readableStream.isObject());109 110 auto getReader = readableStream.getObject()->get(&state, JSC::Identifier::fromString(&state, "getReader"));111 ASSERT(!state.hadException());112 113 auto reader = callFunction(state, getReader, readableStream, JSC::MarkedArgumentBuffer());114 ASSERT(!state.hadException());115 116 return reader;117 }118 119 87 } // namespace WebCore 120 88 -
trunk/Source/WebCore/bindings/js/ReadableStreamController.h
r200235 r203632 67 67 }; 68 68 69 JSC::JSValue createReadableStream(JSC::ExecState&, JSDOMGlobalObject*, ReadableStreamSource*);70 JSC::JSValue getReadableStreamReader(JSC::ExecState&, JSC::JSValue);71 72 69 inline JSDOMGlobalObject* ReadableStreamController::globalObject() const 73 70 { -
trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h
r203494 r203632 35 35 macro(addTrack) \ 36 36 macro(appendFromJS) \ 37 macro(body) \ 37 38 macro(closeRequested) \ 38 39 macro(closedPromiseCapability) \ 39 40 macro(controlledReadableStream) \ 40 41 macro(controller) \ 42 macro(createReadableStreamSource) \ 41 43 macro(disturbed) \ 42 44 macro(fillFromJS) \ … … 47 49 macro(getTracks) \ 48 50 macro(initializeWith) \ 51 macro(isDisturbed) \ 49 52 macro(localStreams) \ 50 53 macro(operations) \ … … 87 90 macro(ReadableStreamReader) \ 88 91 macro(ReadableStreamController) \ 92 macro(Response) \ 89 93 macro(RTCIceCandidate) \ 90 94 macro(RTCSessionDescription) \
Note: See TracChangeset
for help on using the changeset viewer.