Diff
Modified: trunk/LayoutTests/ChangeLog (204019 => 204020)
--- trunk/LayoutTests/ChangeLog 2016-08-02 07:20:23 UTC (rev 204019)
+++ trunk/LayoutTests/ChangeLog 2016-08-02 08:07:28 UTC (rev 204020)
@@ -1,3 +1,17 @@
+2016-08-02 Youenn Fablet <[email protected]>
+
+ [Fetch API] Fetch promises should not reject or resolve when ActiveDOMObjects are being stopped
+ https://bugs.webkit.org/show_bug.cgi?id=160420
+
+ Reviewed by Alex Christensen.
+
+ * TestExpectations:
+ * http/tests/fetch/fetch-in-worker-crash-expected.txt: Added.
+ * http/tests/fetch/fetch-in-worker-crash.html: Added.
+ * http/tests/fetch/fetch-in-worker.js: Added.
+ (onmessage):
+ * platform/ios-simulator-wk2/imported/w3c/web-platform-tests/fetch/api/cors/cors-basic-worker-expected.txt:
+
2016-08-01 Tim Horton <[email protected]>
<attachment> action label doesn't wrap, but needs to for some localizations
Modified: trunk/LayoutTests/TestExpectations (204019 => 204020)
--- trunk/LayoutTests/TestExpectations 2016-08-02 07:20:23 UTC (rev 204019)
+++ trunk/LayoutTests/TestExpectations 2016-08-02 08:07:28 UTC (rev 204020)
@@ -337,31 +337,11 @@
imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-to-non-cors.htm [ Skip ]
# Failing assertion with dynamic message
imported/w3c/web-platform-tests/XMLHttpRequest/responsexml-document-properties.htm [ Failure ]
-# Fetch Worker tests skipped until bug 156737 is resolved
-imported/w3c/web-platform-tests/fetch/api/cors/cors-basic-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/cors/cors-filtering-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/cors/cors-multiple-origins-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/cors/cors-no-preflight-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/cors/cors-origin-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-redirect-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-referrer-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-status-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/cors/cors-redirect-credentials-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/cors/cors-redirect-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/credentials/authentication-basic-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/credentials/cookies-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/policies/csp-blocked-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/policies/referrer-no-referrer-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/policies/referrer-origin-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/policies/referrer-unsafe-url-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode-worker.html [ Skip ]
-imported/w3c/web-platform-tests/fetch/nosniff/worker.html [ Skip ]
+imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-worker.html [ Crash Failure Pass ]
+[ Debug ] imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-worker.html [ Crash Pass ]
+imported/w3c/web-platform-tests/fetch/api/request/request-cache.html [ Skip ]
+
webkit.org/b/157068 imported/w3c/web-platform-tests/fetch/nosniff/importscripts.html [ Skip ]
webkit.org/b/157145 imported/w3c/web-platform-tests/fetch/nosniff/stylesheet.html [ Failure Pass ]
webkit.org/b/159712 imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/document-without-browsing-context.html [ Timeout Failure Pass ]
Added: trunk/LayoutTests/http/tests/fetch/fetch-in-worker-crash-expected.txt (0 => 204020)
--- trunk/LayoutTests/http/tests/fetch/fetch-in-worker-crash-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/fetch/fetch-in-worker-crash-expected.txt 2016-08-02 08:07:28 UTC (rev 204020)
@@ -0,0 +1,5 @@
+CONSOLE MESSAGE: line 11: 0
+CONSOLE MESSAGE: line 11: 1
+Test that terminating an ongoing fetch in a worker does not cause a crash.
+
+PASS: No crash.
Added: trunk/LayoutTests/http/tests/fetch/fetch-in-worker-crash.html (0 => 204020)
--- trunk/LayoutTests/http/tests/fetch/fetch-in-worker-crash.html (rev 0)
+++ trunk/LayoutTests/http/tests/fetch/fetch-in-worker-crash.html 2016-08-02 08:07:28 UTC (rev 204020)
@@ -0,0 +1,25 @@
+<body>
+<p>Test that terminating an ongoing fetch in a worker does not cause a crash.</p> <script>
+ if (testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ worker = new Worker("fetch-in-worker.js");
+
+ worker._onmessage_ = function(e) {
+ console.log(e.data);
+ if (e.data == 0) {
+ worker.postMessage("start");
+ } else {
+ worker.terminate();
+ setTimeout(() => {
+ document.body.innerHTML += "<p>PASS: No crash.</p>";
+ if (testRunner)
+ testRunner.notifyDone();
+ }, 100);
+ }
+ };
+ worker.postMessage("start");
+</script>
+</body>
Added: trunk/LayoutTests/http/tests/fetch/fetch-in-worker.js (0 => 204020)
--- trunk/LayoutTests/http/tests/fetch/fetch-in-worker.js (rev 0)
+++ trunk/LayoutTests/http/tests/fetch/fetch-in-worker.js 2016-08-02 08:07:28 UTC (rev 204020)
@@ -0,0 +1,19 @@
+var counter = 0;
+_onmessage_ = function(e) {
+ if (e.data !== "start")
+ return;
+
+ var promise1 = fetch("detached-frame.html").then(() => {
+ postMessage("FAIL: promise 1 resolved");
+ }, () => {
+ postMessage("FAIL: promise 1 rejected");
+ });
+
+ var promise2 = new Request("test", {method: "POST", body: new Blob(["ab"])}).text().then(() => {
+ postMessage("FAIL: promise 2 resolved");
+ }, () => {
+ postMessage("FAIL: promise 2 rejected");
+ });
+
+ postMessage(counter++);
+}
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (204019 => 204020)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-08-02 07:20:23 UTC (rev 204019)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-08-02 08:07:28 UTC (rev 204020)
@@ -1,5 +1,15 @@
2016-08-02 Youenn Fablet <[email protected]>
+ [Fetch API] Fetch promises should not reject or resolve when ActiveDOMObjects are being stopped
+ https://bugs.webkit.org/show_bug.cgi?id=160420
+
+ Reviewed by Alex Christensen.
+
+ * web-platform-tests/fetch/api/cors/cors-preflight-redirect-worker-expected.txt: Added.
+ * web-platform-tests/fetch/nosniff/worker-expected.txt: Added.
+
+2016-08-02 Youenn Fablet <[email protected]>
+
[Fetch API] Add support to ReferrerPolicy
https://bugs.webkit.org/show_bug.cgi?id=160404
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-redirect-worker-expected.txt (0 => 204020)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-redirect-worker-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-redirect-worker-expected.txt 2016-08-02 08:07:28 UTC (rev 204020)
@@ -0,0 +1,12 @@
+
+PASS Redirection 301 on preflight failed
+PASS Redirection 301 after preflight failed
+PASS Redirection 302 on preflight failed
+PASS Redirection 302 after preflight failed
+PASS Redirection 303 on preflight failed
+PASS Redirection 303 after preflight failed
+PASS Redirection 307 on preflight failed
+PASS Redirection 307 after preflight failed
+PASS Redirection 308 on preflight failed
+PASS Redirection 308 after preflight failed
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/worker-expected.txt (0 => 204020)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/worker-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/nosniff/worker-expected.txt 2016-08-02 08:07:28 UTC (rev 204020)
@@ -0,0 +1,9 @@
+
+FAIL URL query: assert_unreached: Unexpected message event Reached unreachable code
+FAIL URL query: ?type= assert_unreached: Unexpected message event Reached unreachable code
+FAIL URL query: ?type=x assert_unreached: Unexpected message event Reached unreachable code
+FAIL URL query: ?type=x/x assert_unreached: Unexpected message event Reached unreachable code
+PASS URL query: ?type=text/_javascript_
+PASS URL query: ?type=text/ecmascript
+PASS URL query: ?type=text/ecmascript;yay
+
Modified: trunk/LayoutTests/platform/ios-simulator-wk2/imported/w3c/web-platform-tests/fetch/api/cors/cors-basic-worker-expected.txt (204019 => 204020)
--- trunk/LayoutTests/platform/ios-simulator-wk2/imported/w3c/web-platform-tests/fetch/api/cors/cors-basic-worker-expected.txt 2016-08-02 07:20:23 UTC (rev 204019)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/imported/w3c/web-platform-tests/fetch/api/cors/cors-basic-worker-expected.txt 2016-08-02 08:07:28 UTC (rev 204020)
@@ -1,16 +1,16 @@
-FAIL Same domain different port [no-cors mode] assert_equals: Opaque filter: status is 0 expected 0 but got 200
+PASS Same domain different port [no-cors mode]
PASS Same domain different port [server forbid CORS]
-FAIL Same domain different port [cors mode] assert_equals: CORS response's type is cors expected "cors" but got "basic"
+PASS Same domain different port [cors mode]
FAIL Same domain different protocol different port [no-cors mode] promise_test: Unhandled rejection with value: object "TypeError: Type error"
PASS Same domain different protocol different port [server forbid CORS]
FAIL Same domain different protocol different port [cors mode] promise_test: Unhandled rejection with value: object "TypeError: Type error"
-FAIL Cross domain basic usage [no-cors mode] assert_equals: Opaque filter: status is 0 expected 0 but got 200
+PASS Cross domain basic usage [no-cors mode]
PASS Cross domain basic usage [server forbid CORS]
-FAIL Cross domain basic usage [cors mode] assert_equals: CORS response's type is cors expected "cors" but got "basic"
-FAIL Cross domain different port [no-cors mode] assert_equals: Opaque filter: status is 0 expected 0 but got 200
+PASS Cross domain basic usage [cors mode]
+PASS Cross domain different port [no-cors mode]
PASS Cross domain different port [server forbid CORS]
-FAIL Cross domain different port [cors mode] assert_equals: CORS response's type is cors expected "cors" but got "basic"
+PASS Cross domain different port [cors mode]
FAIL Cross domain different protocol [no-cors mode] promise_test: Unhandled rejection with value: object "TypeError: Type error"
PASS Cross domain different protocol [server forbid CORS]
FAIL Cross domain different protocol [cors mode] promise_test: Unhandled rejection with value: object "TypeError: Type error"
Modified: trunk/Source/WebCore/ChangeLog (204019 => 204020)
--- trunk/Source/WebCore/ChangeLog 2016-08-02 07:20:23 UTC (rev 204019)
+++ trunk/Source/WebCore/ChangeLog 2016-08-02 08:07:28 UTC (rev 204020)
@@ -1,5 +1,23 @@
2016-08-02 Youenn Fablet <[email protected]>
+ [Fetch API] Fetch promises should not reject or resolve when ActiveDOMObjects are being stopped
+ https://bugs.webkit.org/show_bug.cgi?id=160420
+
+ Reviewed by Alex Christensen.
+
+ Test: http/tests/fetch/fetch-in-worker-crash.html
+
+ Promises should not be rejected when FetchResponse/FetchRequest are stopped as ActiveDOMObject.
+
+ * Modules/fetch/FetchBody.h:
+ (WebCore::FetchBody::cleanConsumePromise): Allowing to nullify the promise used to consume body.
+ * Modules/fetch/FetchBodyOwner.cpp:
+ (WebCore::FetchBodyOwner::stop): Nullifying the body consume promise if any.
+ * Modules/fetch/FetchResponse.cpp:
+ (WebCore::FetchResponse::BodyLoader::stop): Nullifying the fetch promise if any.
+
+2016-08-02 Youenn Fablet <[email protected]>
+
[Fetch API] Add support to ReferrerPolicy
https://bugs.webkit.org/show_bug.cgi?id=160404
Modified: trunk/Source/WebCore/Modules/fetch/FetchBody.h (204019 => 204020)
--- trunk/Source/WebCore/Modules/fetch/FetchBody.h 2016-08-02 07:20:23 UTC (rev 204019)
+++ trunk/Source/WebCore/Modules/fetch/FetchBody.h 2016-08-02 08:07:28 UTC (rev 204020)
@@ -80,6 +80,8 @@
FetchBodyConsumer& consumer() { return m_consumer; }
+ void cleanConsumePromise() { m_consumePromise = Nullopt; }
+
private:
FetchBody(Ref<Blob>&&);
FetchBody(Ref<DOMFormData>&&);
Modified: trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp (204019 => 204020)
--- trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp 2016-08-02 07:20:23 UTC (rev 204019)
+++ trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp 2016-08-02 08:07:28 UTC (rev 204020)
@@ -48,6 +48,8 @@
void FetchBodyOwner::stop()
{
+ m_body.cleanConsumePromise();
+
if (m_blobLoader) {
if (m_blobLoader->loader)
m_blobLoader->loader->stop();
Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp (204019 => 204020)
--- trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp 2016-08-02 07:20:23 UTC (rev 204019)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp 2016-08-02 08:07:28 UTC (rev 204020)
@@ -197,6 +197,7 @@
void FetchResponse::BodyLoader::stop()
{
+ m_promise = Nullopt;
if (m_loader)
m_loader->stop();
}