http/tests/security/contentSecurityPolicy/worker-csp-blocks-xhr-redirect-cross-origin...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Sep 2016 16:03:39 +0000 (16:03 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Sep 2016 16:03:39 +0000 (16:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=161627

Patch by Youenn Fablet <youenn@apple.com> on 2016-09-06
Reviewed by Darin Adler.

Source/WebCore:

Covered by changed expectation.

* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::redirectReceived): Clearing the resource in lieu of clearing the request. This will stop the resource load.
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::didReceiveResponse): Adding an ASSERT to ensure that no valid redirect responses is mistakenly processed here.

LayoutTests:

* TestExpectations: Removing flakiness expectation.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205481 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/loader/DocumentThreadableLoader.cpp
Source/WebCore/loader/SubresourceLoader.cpp

index 84470addddad6bfa3a9761839788e0e5e228836d..c1bc09cc67a0358d91bac50882a5d71837b5abe5 100644 (file)
@@ -1,3 +1,12 @@
+2016-09-06  Youenn Fablet  <youenn@apple.com>
+
+        http/tests/security/contentSecurityPolicy/worker-csp-blocks-xhr-redirect-cross-origin.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=161627
+
+        Reviewed by Darin Adler.
+
+        * TestExpectations: Removing flakiness expectation.
+
 2016-09-06  Youenn Fablet  <youenn@apple.com>
 
         Using tests-options.json to compute whether tests are slow
index 0ddcfcece8adc0ef1f4646598601e528efd41d89..aa51dbe0713921980c4cb3095abceb2a8dd39367 100644 (file)
@@ -781,8 +781,6 @@ webkit.org/b/155132 http/tests/security/contentSecurityPolicy/video-with-https-u
 http/tests/security/contentSecurityPolicy/script-src-blocked-error-event.html [ Pass Failure ]
 webkit.org/b/158480 http/tests/websocket/tests/hybi/upgrade-simple-ws.html [ Skip ]
 
-webkit.org/b/161389 http/tests/security/contentSecurityPolicy/worker-csp-blocks-xhr-redirect-cross-origin.html [ Pass Failure  ]
-
 # These state object tests purposefully stress a resource limit, and take multiple seconds to run.
 loader/stateobjects/pushstate-size-iframe.html [ Slow ]
 loader/stateobjects/pushstate-size.html [ Slow ]
index abb97a39ab4df46f5f51603ba258ef81f8916e67..6a71a41313a30924d3ff80ef5d36b51218e0ac9d 100644 (file)
@@ -1,3 +1,17 @@
+2016-09-06  Youenn Fablet  <youenn@apple.com>
+
+        http/tests/security/contentSecurityPolicy/worker-csp-blocks-xhr-redirect-cross-origin.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=161627
+
+        Reviewed by Darin Adler.
+
+        Covered by changed expectation.
+
+        * loader/DocumentThreadableLoader.cpp:
+        (WebCore::DocumentThreadableLoader::redirectReceived): Clearing the resource in lieu of clearing the request. This will stop the resource load.
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::didReceiveResponse): Adding an ASSERT to ensure that no valid redirect responses is mistakenly processed here.
+
 2016-09-06  Zalan Bujtas  <zalan@apple.com>
 
         ASSERTION FAILED: !currBox->needsLayout() in WebCore::RenderBlock::checkPositionedObjectsNeedLayout
index d4dd0edc650b64608fa339ce2fb913783df93f59..eed4be47ba7a7c7e9ed370d2bb559355495a2f77 100644 (file)
@@ -222,7 +222,7 @@ void DocumentThreadableLoader::redirectReceived(CachedResource* resource, Resour
     Ref<DocumentThreadableLoader> protectedThis(*this);
     if (!isAllowedByContentSecurityPolicy(request.url(), !redirectResponse.isNull())) {
         reportContentSecurityPolicyError(*m_client, redirectResponse.url());
-        request = ResourceRequest();
+        clearResource();
         return;
     }
 
index c823c0710632630d92b73348c0d21fe0d5205ad2..59b62edceaa1254e8d2232b7f47e08ab503a87bd 100644 (file)
@@ -244,6 +244,9 @@ void SubresourceLoader::didReceiveResponse(const ResourceResponse& response)
     ASSERT(!response.isNull());
     ASSERT(m_state == Initialized);
 
+    // We want redirect responses to be processed through willSendRequestInternal. The only exception is redirection with no Location headers.
+    ASSERT(response.httpStatusCode() < 300 || response.httpStatusCode() >= 400 || response.httpStatusCode() == 304 || !response.httpHeaderField(HTTPHeaderName::Location));
+
     // Reference the object in this method since the additional processing can do
     // anything including removing the last reference to this object; one example of this is 3266216.
     Ref<SubresourceLoader> protectedThis(*this);