WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
WIP Patch
175386_beacon_cors_redirect_wip.patch (text/plain), 3.14 KB, created by
Chris Dumez
on 2017-08-09 09:55:52 PDT
(
hide
)
Description:
WIP Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2017-08-09 09:55:52 PDT
Size:
3.14 KB
patch
obsolete
>diff --git a/Source/WebKit/NetworkProcess/PingLoad.cpp b/Source/WebKit/NetworkProcess/PingLoad.cpp >index 2df014ce54c..64feced46bb 100644 >--- a/Source/WebKit/NetworkProcess/PingLoad.cpp >+++ b/Source/WebKit/NetworkProcess/PingLoad.cpp >@@ -55,6 +55,9 @@ PingLoad::PingLoad(NetworkResourceLoadParameters&& parameters) > > PingLoad::~PingLoad() > { >+ if (m_redirectHandler) >+ m_redirectHandler({ }); >+ > if (m_task) { > ASSERT(m_task->client() == this); > m_task->clearClient(); >@@ -74,10 +77,18 @@ void PingLoad::startNetworkLoad() > > void PingLoad::willPerformHTTPRedirection(ResourceResponse&&, ResourceRequest&& request, RedirectCompletionHandler&& completionHandler) > { >- RELEASE_LOG_IF_ALLOWED("willPerformHTTPRedirection"); >- // FIXME: Do a CORS preflight if necessary. >+ RELEASE_LOG_IF_ALLOWED("willPerformHTTPRedirection - shouldFollowRedirects? %d", m_parameters.shouldFollowRedirects); >+ if (!m_parameters.shouldFollowRedirects) { >+ completionHandler({ }); >+ return; >+ } > // FIXME: We should ensure the number of redirects does not exceed 20. >- completionHandler(m_parameters.shouldFollowRedirects ? request : ResourceRequest()); >+ if (needsCORSPreflight(request)) { >+ RELEASE_LOG_IF_ALLOWED("willPerformHTTPRedirection - Redirect requires a CORS preflight"); >+ m_redirectHandler = WTFMove(completionHandler); >+ doCORSPreflight(request); >+ } else >+ completionHandler(request); > } > > void PingLoad::didReceiveChallenge(const AuthenticationChallenge&, ChallengeCompletionHandler&& completionHandler) >@@ -152,11 +163,14 @@ void PingLoad::doCORSPreflight(const ResourceRequest& request) > m_parameters.sessionID, > m_parameters.allowStoredCredentials > }; >- m_corsPreflightChecker = std::make_unique<NetworkCORSPreflightChecker>(WTFMove(parameters), [this](NetworkCORSPreflightChecker::Result result) { >- RELEASE_LOG_IF_ALLOWED("doCORSPreflight complete, success: %d", result == NetworkCORSPreflightChecker::Result::Success); >+ m_corsPreflightChecker = std::make_unique<NetworkCORSPreflightChecker>(WTFMove(parameters), [this, request](NetworkCORSPreflightChecker::Result result) { >+ RELEASE_LOG_IF_ALLOWED("doCORSPreflight complete, success: %d forRedirect? %d", result == NetworkCORSPreflightChecker::Result::Success, !!m_redirectHandler); > if (result == NetworkCORSPreflightChecker::Result::Success) { > m_corsPreflightChecker = nullptr; >- startNetworkLoad(); >+ if (auto redirectHandler = std::exchange(m_redirectHandler, nullptr)) >+ redirectHandler(request); >+ else >+ startNetworkLoad(); > } else > delete this; > }); >diff --git a/Source/WebKit/NetworkProcess/PingLoad.h b/Source/WebKit/NetworkProcess/PingLoad.h >index 8872d2f4bc2..a156b366ef7 100644 >--- a/Source/WebKit/NetworkProcess/PingLoad.h >+++ b/Source/WebKit/NetworkProcess/PingLoad.h >@@ -59,6 +59,7 @@ private: > RefPtr<NetworkDataTask> m_task; > WebCore::Timer m_timeoutTimer; > std::unique_ptr<NetworkCORSPreflightChecker> m_corsPreflightChecker; >+ RedirectCompletionHandler m_redirectHandler; > }; > > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 175386
:
317714
|
317721
|
317733
|
317734
|
317743