Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp

Issue 2570473002: Enable the CORS preflight for sendBeacon()
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
index 928aa32bd8fc3466efe8b913ac438d55699d3814..bfa3ab79e3db1607826354390a0561b4cab164b8 100644
--- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
@@ -49,6 +49,8 @@
#include "core/page/ChromeClient.h"
#include "core/page/Page.h"
#include "platform/SharedBuffer.h"
+#include "platform/WebFrameScheduler.h"
+#include "platform/network/NetworkLog.h"
#include "platform/network/ResourceRequest.h"
#include "platform/weborigin/SchemeRegistry.h"
#include "platform/weborigin/SecurityOrigin.h"
@@ -696,6 +698,8 @@ void DocumentThreadableLoader::responseReceived(
void DocumentThreadableLoader::handlePreflightResponse(
const ResourceResponse& response) {
+ NETWORK_DVLOG(1) << this << " handlePreflightResponse()";
+
String accessControlErrorDescription;
if (!passesAccessControlCheck(
@@ -705,12 +709,14 @@ void DocumentThreadableLoader::handlePreflightResponse(
response.url().getString(),
"Response to preflight request doesn't pass access control check: " +
accessControlErrorDescription);
+ NETWORK_DVLOG(1) << this << " 2()";
return;
}
if (!passesPreflightStatusCheck(response, accessControlErrorDescription)) {
handlePreflightFailure(response.url().getString(),
accessControlErrorDescription);
+ NETWORK_DVLOG(1) << this << " 1()";
return;
}
@@ -718,6 +724,7 @@ void DocumentThreadableLoader::handlePreflightResponse(
!passesExternalPreflightCheck(response, accessControlErrorDescription)) {
handlePreflightFailure(response.url().getString(),
accessControlErrorDescription);
+ NETWORK_DVLOG(1) << this << " 3()";
return;
}
@@ -731,6 +738,8 @@ void DocumentThreadableLoader::handlePreflightResponse(
m_actualRequest.httpHeaderFields(), accessControlErrorDescription)) {
handlePreflightFailure(response.url().getString(),
accessControlErrorDescription);
+ NETWORK_DVLOG(1) << this << " 4() "
+ << accessControlErrorDescription.utf8().data();
return;
}
@@ -993,14 +1002,21 @@ void DocumentThreadableLoader::loadRequestAsync(
return;
}
- if (resource()->isLoading()) {
- unsigned long identifier = resource()->identifier();
- InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(
- m_document, identifier, m_client);
- } else {
+ if (!resource()->isLoading()) {
InspectorInstrumentation::
documentThreadableLoaderFailedToStartLoadingForClient(m_document,
m_client);
+ return;
+ }
+
+ unsigned long identifier = resource()->identifier();
+ InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(
+ m_document, identifier, m_client);
+
+ if (m_options.schedulerWaitingPolicy == PreventSchedulerFromWaiting) {
+ LocalFrame* frame = document().frame();
+ if (frame && frame->frameScheduler())
+ frame->frameScheduler()->didStopLoading(identifier);
}
}

Powered by Google App Engine
This is Rietveld 408576698