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

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

Issue 1742923002: Commit empty document instead of canceling the load for blocked CSP/XFO responses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address japhet@'s comment Created 4 years, 10 months 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
« no previous file with comments | « third_party/WebKit/Source/core/loader/DocumentLoader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/DocumentLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
index 8868bda7f8631457ea7dd08ca2a25a180ed7d1a6..2f58bbae49401712035380b874fbffabab702dc4 100644
--- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
@@ -94,6 +94,7 @@ DocumentLoader::DocumentLoader(LocalFrame* frame, const ResourceRequest& req, co
, m_documentLoadTiming(*this)
, m_timeOfLastDataReceived(0.0)
, m_applicationCacheHost(ApplicationCacheHost::create(this))
+ , m_wasBlockedAfterXFrameOptionsOrCSP(false)
, m_state(NotStarted)
, m_inDataReceived(false)
, m_dataBuffer(SharedBuffer::create())
@@ -379,13 +380,13 @@ void DocumentLoader::cancelLoadAfterXFrameOptionsOrCSPDenied(const ResourceRespo
{
InspectorInstrumentation::continueAfterXFrameOptionsDenied(m_frame, this, mainResourceIdentifier(), response);
- frame()->document()->enforceSandboxFlags(SandboxOrigin);
- if (FrameOwner* owner = frame()->owner())
- owner->dispatchLoad();
+ setWasBlockedAfterXFrameOptionsOrCSP();
+
+ // Pretend that this was an empty HTTP 200 response.
+ clearMainResourceHandle();
+ m_response = ResourceResponse(blankURL(), "text/html", 0, nullAtom, String());
+ finishedLoading(monotonicallyIncreasingTime());
- // The load event might have detached this frame. In that case, the load will already have been cancelled during detach.
- if (frameLoader())
- cancelMainResourceLoad(ResourceError::cancelledError(m_request.url()));
return;
}
« no previous file with comments | « third_party/WebKit/Source/core/loader/DocumentLoader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698