Skip to content
Permalink
Browse files
LayoutTest imported/w3c/web-platform-tests/xhr/event-upload-progress-…
…crossorigin.htm is a flaky failure

https://bugs.webkit.org/show_bug.cgi?id=182849
<rdar://problem/50353372>

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Modernize the test and add an assertion that the body is transmitted after a redirection.

* web-platform-tests/xhr/event-upload-progress-crossorigin.htm:

Source/WebKit:

In case of restarting the load after a redirection, which now happens in case
of following cross origin redirections with same-origin credentials, make sure to
update the request as would do NetworkLoad.
This is in particular important to preserve the request body.

Covered by WPT updated test.

* NetworkProcess/NetworkLoad.cpp:
(WebKit::updateRequest):
(WebKit::NetworkLoad::updateRequestAfterRedirection const):
(WebKit::NetworkLoad::continueWillSendRequest):
* NetworkProcess/NetworkLoad.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::continueWillSendRequest):

LayoutTests:

* platform/mac-wk2/TestExpectations:


Canonical link: https://commits.webkit.org/211702@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244910 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
youennf committed May 3, 2019
1 parent 867079e commit 22535e09f239c249d94a71a26ccf04fbf5cb8eba
@@ -1,3 +1,13 @@
2019-05-03 Youenn Fablet <youenn@apple.com>

LayoutTest imported/w3c/web-platform-tests/xhr/event-upload-progress-crossorigin.htm is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=182849
<rdar://problem/50353372>

Reviewed by Alex Christensen.

* platform/mac-wk2/TestExpectations:

2019-05-03 Devin Rousso <drousso@apple.com>

Web Inspector: Record actions performed on WebGL2RenderingContext
@@ -1,3 +1,15 @@
2019-05-03 Youenn Fablet <youenn@apple.com>

LayoutTest imported/w3c/web-platform-tests/xhr/event-upload-progress-crossorigin.htm is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=182849
<rdar://problem/50353372>

Reviewed by Alex Christensen.

Modernize the test and add an assertion that the body is transmitted after a redirection.

* web-platform-tests/xhr/event-upload-progress-crossorigin.htm:

2019-05-03 Joonghun Park <jh718.park@samsung.com>

Resolve the percentage values of inset properties against proper box.
@@ -11,23 +11,42 @@
redirect = "resources/redirect.py?code=307&location=" + remote;

[remote, redirect].forEach(url => {
async_test(test => {
promise_test(async test => {
const client = new XMLHttpRequest();
client.upload.onprogress = test.step_func_done()
client.onload = test.unreached_func()
client.open("POST", url)
client.send("On time: " + url)

const loadFinished = new Promise(resolve => client.onloadend = resolve);
const progressReceived = new Promise(resolve => client.upload.onprogress = resolve);
const loadReceived = new Promise((resolve, reject) => client.onload = () => { reject("load event received") });

const body = "On time: " + url;
client.open("POST", url);
client.send(body);

await Promise.race([progressReceived, loadReceived]);

await loadFinished;
assert_equals(client.getResponseHeader("X-Request-Data"), body, "test body");
}, "Upload events registered on time (" + url + ")");
});

[remote, redirect].forEach(url => {
async_test(test => {
promise_test(async test => {
const client = new XMLHttpRequest();
client.onload = test.step_func_done();

const loadFinished = new Promise(resolve => client.onloadend = resolve);
const loadReceived = new Promise(resolve => client.onload = resolve);

const body = "Too late: " + url;
client.open("POST", url);
client.send("Too late: " + url);
client.upload.onloadstart = test.unreached_func(); // registered too late
client.upload.onprogress = test.unreached_func(); // registered too late
client.send(body);

const loadstartReceived = new Promise((resolve, reject) => client.upload.onloadstart = () => { reject("loadstart event received") });
const progressReceived = new Promise((resolve, reject) => client.upload.onprogress = () => { reject("progress event received") });

await Promise.race([loadReceived, progressReceived, loadstartReceived]);

await loadFinished;
assert_equals(client.getResponseHeader("X-Request-Data"), body);
}, "Upload events registered too late (" + url + ")");
});
</script>
@@ -832,8 +832,6 @@ webkit.org/b/182341 imported/w3c/web-platform-tests/service-workers/service-work

webkit.org/b/179352 imported/w3c/web-platform-tests/service-workers/service-worker/windowclient-navigate.https.html [ Pass Failure Slow ]

webkit.org/b/182849 imported/w3c/web-platform-tests/xhr/event-upload-progress-crossorigin.htm [ Pass Failure ]

webkit.org/b/183164 fast/dom/Window/window-focus-self.html [ Pass Failure ]

webkit.org/b/180982 [ Debug ] imported/w3c/web-platform-tests/service-workers/service-worker/registration-updateviacache.https.html [ Slow ]
@@ -1,3 +1,26 @@
2019-05-03 Youenn Fablet <youenn@apple.com>

LayoutTest imported/w3c/web-platform-tests/xhr/event-upload-progress-crossorigin.htm is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=182849
<rdar://problem/50353372>

Reviewed by Alex Christensen.

In case of restarting the load after a redirection, which now happens in case
of following cross origin redirections with same-origin credentials, make sure to
update the request as would do NetworkLoad.
This is in particular important to preserve the request body.

Covered by WPT updated test.

* NetworkProcess/NetworkLoad.cpp:
(WebKit::updateRequest):
(WebKit::NetworkLoad::updateRequestAfterRedirection const):
(WebKit::NetworkLoad::continueWillSendRequest):
* NetworkProcess/NetworkLoad.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::continueWillSendRequest):

2019-05-03 Commit Queue <commit-queue@webkit.org>

Unreviewed, rolling out r244881.
@@ -90,14 +90,26 @@ void NetworkLoad::cancel()
m_task->cancel();
}

void NetworkLoad::continueWillSendRequest(WebCore::ResourceRequest&& newRequest)
static inline void updateRequest(ResourceRequest& currentRequest, const ResourceRequest& newRequest)
{
#if PLATFORM(COCOA)
m_currentRequest.updateFromDelegatePreservingOldProperties(newRequest.nsURLRequest(HTTPBodyUpdatePolicy::DoNotUpdateHTTPBody));
currentRequest.updateFromDelegatePreservingOldProperties(newRequest.nsURLRequest(HTTPBodyUpdatePolicy::DoNotUpdateHTTPBody));
#else
// FIXME: Implement ResourceRequest::updateFromDelegatePreservingOldProperties. See https://bugs.webkit.org/show_bug.cgi?id=126127.
m_currentRequest.updateFromDelegatePreservingOldProperties(newRequest);
currentRequest.updateFromDelegatePreservingOldProperties(newRequest);
#endif
}

void NetworkLoad::updateRequestAfterRedirection(WebCore::ResourceRequest& newRequest) const
{
ResourceRequest updatedRequest = m_currentRequest;
updateRequest(updatedRequest, newRequest);
newRequest = WTFMove(updatedRequest);
}

void NetworkLoad::continueWillSendRequest(WebCore::ResourceRequest&& newRequest)
{
updateRequest(m_currentRequest, newRequest);

auto redirectCompletionHandler = std::exchange(m_redirectCompletionHandler, nullptr);
ASSERT(redirectCompletionHandler);
@@ -52,6 +52,7 @@ class NetworkLoad final : private NetworkDataTaskClient {
bool isAllowedToAskUserForCredentials() const;

const WebCore::ResourceRequest& currentRequest() const { return m_currentRequest; }
void updateRequestAfterRedirection(WebCore::ResourceRequest&) const;

const NetworkLoadParameters& parameters() const { return m_parameters; }

@@ -701,6 +701,10 @@ void NetworkResourceLoader::continueWillSendRequest(ResourceRequest&& newRequest
{
if (m_shouldRestartLoad) {
m_shouldRestartLoad = false;

if (m_networkLoad)
m_networkLoad->updateRequestAfterRedirection(newRequest);

restartNetworkLoad(WTFMove(newRequest));
return;
}

0 comments on commit 22535e0

Please sign in to comment.