Changeset 248283 in webkit
- Timestamp:
- Aug 5, 2019 5:36:09 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 deleted
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r248279 r248283 1 2019-08-05 Youenn Fablet <youenn@apple.com> 2 3 Support RTCRtpSender.dtmf 4 https://bugs.webkit.org/show_bug.cgi?id=200431 5 <rdar://problem/53924833> 6 7 Reviewed by Alex Christensen. 8 9 Removed cache storage test which is no longer valid. 10 Removed WK1 expectation that is no longer needed. 11 12 * http/wpt/cache-storage/cache-put-stream.https.any.html: Removed. 13 * http/wpt/cache-storage/cache-put-stream.https.any.js: Removed. 14 * http/wpt/cache-storage/cache-put-stream.https.any.worker.html: Removed. 15 * platform/mac-wk1/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any-expected.txt: Removed. 16 * platform/mac-wk2/TestExpectations: 17 1 18 2019-08-05 Devin Rousso <drousso@apple.com> 2 19 -
trunk/LayoutTests/imported/w3c/ChangeLog
r248282 r248283 1 2019-08-05 Youenn Fablet <youenn@apple.com> 2 3 Response constructor doesn't throw on disturbed ReadableStream 4 https://bugs.webkit.org/show_bug.cgi?id=200130 5 <rdar://problem/53550351> 6 7 Reviewed by Alex Christensen. 8 9 Update test to use promise_rejects instead of assert_throws. 10 11 * web-platform-tests/fetch/api/request/request-init-stream.any-expected.txt: 12 * web-platform-tests/fetch/api/request/request-init-stream.any.js: 13 (async.assert_request): 14 (promise_test.async): 15 * web-platform-tests/fetch/api/request/request-init-stream.any.worker-expected.txt: 16 * web-platform-tests/fetch/api/response/response-from-stream.any-expected.txt: 17 * web-platform-tests/fetch/api/response/response-from-stream.any.worker-expected.txt: 18 1 19 2019-08-05 Youenn Fablet <youenn@apple.com> 2 20 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any-expected.txt
r239693 r248283 1 1 2 FAIL Constructing a Request with a stream on which getReader() is called assert_throws: new Request() function "() => new Request(input, init)" did not throw 3 FAIL Constructing a Request with a stream on which read() is called assert_throws: new Request() function "() => new Request(input, init)" did not throw 4 FAIL Constructing a Request with a stream on which read() and releaseLock() are called assert_throws: new Request() function "() => new Request(input, init)" did not throw 5 FAIL Constructing a Request with a Request on which body.getReader() is called assert_throws: fetch() function "async () => await fetch(input, init)" did not throw 6 FAIL Constructing a Request with a Request on which body.getReader().read() is called assert_throws: fetch() function "async () => await fetch(input, init)" did not throw 7 FAIL Constructing a Request with a Request on which read() and releaseLock() are called assert_throws: fetch() function "async () => await fetch(input, init)" did not throw 2 PASS Constructing a Request with a stream on which getReader() is called 3 PASS Constructing a Request with a stream on which read() is called 4 PASS Constructing a Request with a stream on which read() and releaseLock() are called 5 PASS Constructing a Request with a Request on which body.getReader() is called 6 PASS Constructing a Request with a Request on which body.getReader().read() is called 7 PASS Constructing a Request with a Request on which read() and releaseLock() are called 8 8 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any.js
r239693 r248283 3 3 "use strict"; 4 4 5 async function assert_request( input, init) {5 async function assert_request(t, input, init) { 6 6 assert_throws(new TypeError(), () => new Request(input, init), "new Request()"); 7 a ssert_throws(new TypeError(), async () => await fetch(input, init), "fetch()");7 await promise_rejects(t, new TypeError(), fetch(input, init)); 8 8 } 9 9 10 promise_test(async ( ) => {10 promise_test(async (t) => { 11 11 const stream = new ReadableStream(); 12 12 stream.getReader(); 13 await assert_request( "...", { method:"POST", body: stream });13 await assert_request(t, "...", { method:"POST", body: stream }); 14 14 }, "Constructing a Request with a stream on which getReader() is called"); 15 15 16 promise_test(async ( ) => {16 promise_test(async (t) => { 17 17 const stream = new ReadableStream(); 18 18 stream.getReader().read(); 19 await assert_request( "...", { method:"POST", body: stream });19 await assert_request(t, "...", { method:"POST", body: stream }); 20 20 }, "Constructing a Request with a stream on which read() is called"); 21 21 22 promise_test(async ( ) => {22 promise_test(async (t) => { 23 23 const stream = new ReadableStream({ pull: c => c.enqueue(new Uint8Array()) }), 24 24 reader = stream.getReader(); 25 25 await reader.read(); 26 26 reader.releaseLock(); 27 await assert_request( "...", { method:"POST", body: stream });27 await assert_request(t, "...", { method:"POST", body: stream }); 28 28 }, "Constructing a Request with a stream on which read() and releaseLock() are called"); 29 29 30 promise_test(async ( ) => {30 promise_test(async (t) => { 31 31 const request = new Request("...", { method: "POST", body: "..." }); 32 32 request.body.getReader(); 33 await assert_request( request);33 await assert_request(t, request); 34 34 assert_class_string(new Request(request, { body: "..." }), "Request"); 35 35 }, "Constructing a Request with a Request on which body.getReader() is called"); 36 36 37 promise_test(async ( ) => {37 promise_test(async (t) => { 38 38 const request = new Request("...", { method: "POST", body: "..." }); 39 39 request.body.getReader().read(); 40 await assert_request( request);40 await assert_request(t, request); 41 41 assert_class_string(new Request(request, { body: "..." }), "Request"); 42 42 }, "Constructing a Request with a Request on which body.getReader().read() is called"); 43 43 44 promise_test(async ( ) => {44 promise_test(async (t) => { 45 45 const request = new Request("...", { method: "POST", body: "..." }), 46 46 reader = request.body.getReader(); 47 47 await reader.read(); 48 48 reader.releaseLock(); 49 await assert_request( request);49 await assert_request(t, request); 50 50 assert_class_string(new Request(request, { body: "..." }), "Request"); 51 51 }, "Constructing a Request with a Request on which read() and releaseLock() are called"); -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any.worker-expected.txt
r239693 r248283 1 1 2 FAIL Constructing a Request with a stream on which getReader() is called assert_throws: new Request() function "() => new Request(input, init)" did not throw 3 FAIL Constructing a Request with a stream on which read() is called assert_throws: new Request() function "() => new Request(input, init)" did not throw 4 FAIL Constructing a Request with a stream on which read() and releaseLock() are called assert_throws: new Request() function "() => new Request(input, init)" did not throw 5 FAIL Constructing a Request with a Request on which body.getReader() is called assert_throws: fetch() function "async () => await fetch(input, init)" did not throw 6 FAIL Constructing a Request with a Request on which body.getReader().read() is called assert_throws: fetch() function "async () => await fetch(input, init)" did not throw 7 FAIL Constructing a Request with a Request on which read() and releaseLock() are called assert_throws: fetch() function "async () => await fetch(input, init)" did not throw 2 PASS Constructing a Request with a stream on which getReader() is called 3 PASS Constructing a Request with a stream on which read() is called 4 PASS Constructing a Request with a stream on which read() and releaseLock() are called 5 PASS Constructing a Request with a Request on which body.getReader() is called 6 PASS Constructing a Request with a Request on which body.getReader().read() is called 7 PASS Constructing a Request with a Request on which read() and releaseLock() are called 8 8 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any-expected.txt
r239693 r248283 1 1 2 FAIL Constructing a Response with a stream on which getReader() is called assert_throws: function "() => new Response(stream)" did not throw 3 FAIL Constructing a Response with a stream on which read() is called assert_throws: function "() => new Response(stream)" did not throw 4 FAIL Constructing a Response with a stream on which read() and releaseLock() are called assert_throws: function "() => new Response(stream)" did not throw 2 PASS Constructing a Response with a stream on which getReader() is called 3 PASS Constructing a Response with a stream on which read() is called 4 PASS Constructing a Response with a stream on which read() and releaseLock() are called 5 5 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-from-stream.any.worker-expected.txt
r239693 r248283 1 1 2 FAIL Constructing a Response with a stream on which getReader() is called assert_throws: function "() => new Response(stream)" did not throw 3 FAIL Constructing a Response with a stream on which read() is called assert_throws: function "() => new Response(stream)" did not throw 4 FAIL Constructing a Response with a stream on which read() and releaseLock() are called assert_throws: function "() => new Response(stream)" did not throw 2 PASS Constructing a Response with a stream on which getReader() is called 3 PASS Constructing a Response with a stream on which read() is called 4 PASS Constructing a Response with a stream on which read() and releaseLock() are called 5 5 -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r248273 r248283 830 830 webkit.org/b/181167 imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/update.https.html [ Pass Failure ] 831 831 832 http/wpt/cache-storage/cache-put-stream.https.any.html [ Slow ]833 832 http/wpt/cache-storage/cache-put-keys.https.any.html [ Slow ] 834 833 http/wpt/cache-storage/a-cache-open.https.html [ Slow ] 835 http/wpt/cache-storage/cache-put-stream.https.any.worker.html [ Slow ]836 834 http/wpt/cache-storage/cache-quota.any.html [ Slow ] 837 835 http/wpt/cache-storage/cache-put-keys.https.any.worker.html [ Slow ] -
trunk/Source/WebCore/ChangeLog
r248282 r248283 1 2019-08-05 Youenn Fablet <youenn@apple.com> 2 3 Response constructor doesn't throw on disturbed ReadableStream 4 https://bugs.webkit.org/show_bug.cgi?id=200130 5 <rdar://problem/53550351> 6 7 Reviewed by Alex Christensen. 8 9 Make FetchBody::extract return an exception in error cases. 10 Update call sites accordingly. 11 Add the error case as per https://fetch.spec.whatwg.org/#concept-bodyinit-extract, ReadableStream handling. 12 13 Covered by updated and rebased tests. 14 15 * Modules/beacon/NavigatorBeacon.cpp: 16 (WebCore::NavigatorBeacon::sendBeacon): 17 * Modules/fetch/FetchBody.cpp: 18 (WebCore::FetchBody::extract): 19 * Modules/fetch/FetchBody.h: 20 * Modules/fetch/FetchBodyOwner.cpp: 21 (WebCore::FetchBodyOwner::extractBody): 22 * Modules/fetch/FetchBodyOwner.h: 23 * Modules/fetch/FetchRequest.cpp: 24 (WebCore::FetchRequest::initializeWith): 25 (WebCore::FetchRequest::setBody): 26 * Modules/fetch/FetchResponse.cpp: 27 (WebCore::FetchResponse::create): 28 * Modules/streams/ReadableStreamInternals.js: 29 (readableStreamPipeTo): fix a case where the promise would be unhandled and would show up in 30 unhandledrejectionhandler. 31 1 32 2019-08-05 Youenn Fablet <youenn@apple.com> 2 33 -
trunk/Source/WebCore/Modules/beacon/NavigatorBeacon.cpp
r245344 r248283 133 133 options.mode = FetchOptions::Mode::Cors; 134 134 String mimeType; 135 auto fetchBody = FetchBody::extract(document, WTFMove(body.value()), mimeType); 136 135 auto result = FetchBody::extract(WTFMove(body.value()), mimeType); 136 if (result.hasException()) 137 return result.releaseException(); 138 auto fetchBody = result.releaseReturnValue(); 137 139 if (fetchBody.hasReadableStream()) 138 140 return Exception { TypeError, "Beacons cannot send ReadableStream body"_s }; -
trunk/Source/WebCore/Modules/fetch/FetchBody.cpp
r248139 r248283 41 41 namespace WebCore { 42 42 43 FetchBody FetchBody::extract(ScriptExecutionContext&,Init&& value, String& contentType)44 { 45 return WTF::switchOn(value, [&](RefPtr<Blob>& value) mutable {43 ExceptionOr<FetchBody> FetchBody::extract(Init&& value, String& contentType) 44 { 45 return WTF::switchOn(value, [&](RefPtr<Blob>& value) mutable -> ExceptionOr<FetchBody> { 46 46 Ref<const Blob> blob = value.releaseNonNull(); 47 47 if (!blob->type().isEmpty()) 48 48 contentType = blob->type(); 49 49 return FetchBody(WTFMove(blob)); 50 }, [&](RefPtr<DOMFormData>& value) mutable {50 }, [&](RefPtr<DOMFormData>& value) mutable -> ExceptionOr<FetchBody> { 51 51 Ref<DOMFormData> domFormData = value.releaseNonNull(); 52 52 auto formData = FormData::createMultiPart(domFormData.get()); 53 53 contentType = makeString("multipart/form-data; boundary=", formData->boundary().data()); 54 54 return FetchBody(WTFMove(formData)); 55 }, [&](RefPtr<URLSearchParams>& value) mutable {55 }, [&](RefPtr<URLSearchParams>& value) mutable -> ExceptionOr<FetchBody> { 56 56 Ref<const URLSearchParams> params = value.releaseNonNull(); 57 57 contentType = HTTPHeaderValues::formURLEncodedContentType(); 58 58 return FetchBody(WTFMove(params)); 59 }, [&](RefPtr<ArrayBuffer>& value) mutable {59 }, [&](RefPtr<ArrayBuffer>& value) mutable -> ExceptionOr<FetchBody> { 60 60 Ref<const ArrayBuffer> buffer = value.releaseNonNull(); 61 61 return FetchBody(WTFMove(buffer)); 62 }, [&](RefPtr<ArrayBufferView>& value) mutable {62 }, [&](RefPtr<ArrayBufferView>& value) mutable -> ExceptionOr<FetchBody> { 63 63 Ref<const ArrayBufferView> buffer = value.releaseNonNull(); 64 64 return FetchBody(WTFMove(buffer)); 65 }, [&](RefPtr<ReadableStream>& stream) mutable { 65 }, [&](RefPtr<ReadableStream>& stream) mutable -> ExceptionOr<FetchBody> { 66 if (stream->isDisturbed()) 67 return Exception { TypeError, "Input body is disturbed."_s }; 68 if (stream->isLocked()) 69 return Exception { TypeError, "Input body is locked."_s }; 70 66 71 return FetchBody(stream.releaseNonNull()); 67 }, [&](String& value) {72 }, [&](String& value) -> ExceptionOr<FetchBody> { 68 73 contentType = HTTPHeaderValues::textPlainContentType(); 69 74 return FetchBody(WTFMove(value)); -
trunk/Source/WebCore/Modules/fetch/FetchBody.h
r239644 r248283 30 30 31 31 #include "DOMFormData.h" 32 #include "ExceptionOr.h" 32 33 #include "FetchBodyConsumer.h" 33 34 #include "FormData.h" … … 56 57 57 58 using Init = Variant<RefPtr<Blob>, RefPtr<ArrayBufferView>, RefPtr<ArrayBuffer>, RefPtr<DOMFormData>, RefPtr<URLSearchParams>, RefPtr<ReadableStream>, String>; 58 static FetchBody extract(ScriptExecutionContext&,Init&&, String&);59 static ExceptionOr<FetchBody> extract(Init&&, String&); 59 60 FetchBody() = default; 60 61 -
trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp
r240237 r248283 146 146 } 147 147 148 void FetchBodyOwner::extractBody(ScriptExecutionContext& context, FetchBody::Init&& value) 149 { 150 m_body = FetchBody::extract(context, WTFMove(value), m_contentType); 148 ExceptionOr<void> FetchBodyOwner::extractBody(FetchBody::Init&& value) 149 { 150 auto result = FetchBody::extract(WTFMove(value), m_contentType); 151 if (result.hasException()) 152 return result.releaseException(); 153 m_body = result.releaseReturnValue(); 154 return { }; 151 155 } 152 156 -
trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.h
r239644 r248283 78 78 void cloneBody(FetchBodyOwner&); 79 79 80 void extractBody(ScriptExecutionContext&,FetchBody::Init&&);80 ExceptionOr<void> extractBody(FetchBody::Init&&); 81 81 void updateContentType(); 82 82 void consumeOnceLoadingFinished(FetchBodyConsumer::Type, Ref<DeferredPromise>&&); -
trunk/Source/WebCore/Modules/fetch/FetchRequest.cpp
r247213 r248283 223 223 m_signal->follow(input.m_signal.get()); 224 224 225 if (init.headers) { 226 auto fillResult = m_headers->fill(*init.headers); 227 if (fillResult.hasException()) 228 return fillResult.releaseException(); 229 } else { 230 auto fillResult = m_headers->fill(input.headers()); 231 if (fillResult.hasException()) 232 return fillResult.releaseException(); 233 } 234 235 if (init.body) { 236 auto setBodyResult = setBody(WTFMove(*init.body)); 237 if (setBodyResult.hasException()) 238 return setBodyResult.releaseException(); 239 } else { 240 if (input.isDisturbedOrLocked()) 241 return Exception { TypeError, "Request input is disturbed or locked."_s }; 242 243 auto setBodyResult = setBody(input); 244 if (setBodyResult.hasException()) 245 return setBodyResult.releaseException(); 246 } 225 auto fillResult = init.headers ? m_headers->fill(*init.headers) : m_headers->fill(input.headers()); 226 if (fillResult.hasException()) 227 return fillResult; 228 229 auto setBodyResult = init.body ? setBody(WTFMove(*init.body)) : setBody(input); 230 if (setBodyResult.hasException()) 231 return setBodyResult; 247 232 248 233 updateContentType(); … … 256 241 257 242 ASSERT(scriptExecutionContext()); 258 extractBody(*scriptExecutionContext(), WTFMove(body)); 243 auto result = extractBody(WTFMove(body)); 244 if (result.hasException()) 245 return result; 259 246 260 247 if (m_options.keepAlive && hasReadableStreamBody()) … … 265 252 ExceptionOr<void> FetchRequest::setBody(FetchRequest& request) 266 253 { 254 if (request.isDisturbedOrLocked()) 255 return Exception { TypeError, "Request input is disturbed or locked."_s }; 256 267 257 if (!request.isBodyNull()) { 268 258 if (!methodCanHaveBody(m_request)) -
trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp
r247087 r248283 104 104 105 105 // 8.3 Set r’s response’s body and Content-Type to the result of extracting body. 106 extractedBody = FetchBody::extract(context, WTFMove(*body), contentType); 106 auto result = FetchBody::extract(WTFMove(*body), contentType); 107 if (result.hasException()) 108 return result.releaseException(); 109 extractedBody = result.releaseReturnValue(); 107 110 108 111 // 8.4 If Content-Type is non-null and r’s response’s header list does not contain `Content-Type`, then append -
trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js
r242365 r248283 114 114 } 115 115 doPipe(); 116 }, function(e) { 117 sink.error(e); 116 118 }); 117 119 }
Note: See TracChangeset
for help on using the changeset viewer.