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

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

Issue 1964303003: UPGRADE: Correctly handle navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forms. Created 4 years, 7 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/FormSubmission.cpp ('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/FrameFetchContext.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
index 167da90332473df36b56720b9977236babb20d40..17bfc33d25547ed9cc7f4d10fc25accad84c2389 100644
--- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -666,9 +666,11 @@ void FrameFetchContext::upgradeInsecureRequest(FetchRequest& fetchRequest)
if (fetchRequest.resourceRequest().frameType() != WebURLRequest::FrameTypeNone)
fetchRequest.mutableResourceRequest().addHTTPHeaderField("Upgrade-Insecure-Requests", "1");
- if (m_document && m_document->getInsecureRequestsPolicy() == SecurityContext::InsecureRequestsUpgrade && url.protocolIs("http")) {
- ASSERT(m_document->insecureNavigationsToUpgrade());
+ // If we don't yet have an |m_document| (because we're loading an iframe, for instance), check the FrameLoader's policy.
+ SecurityContext::InsecureRequestsPolicy relevantPolicy = m_document ? m_document->getInsecureRequestsPolicy() : frame()->loader().getInsecureRequestsPolicy();
+ SecurityContext::InsecureNavigationsSet* relevantNavigationSet = m_document ? m_document->insecureNavigationsToUpgrade() : frame()->loader().insecureNavigationsToUpgrade();
+ if (url.protocolIs("http") && relevantPolicy == SecurityContext::InsecureRequestsUpgrade) {
// We always upgrade requests that meet any of the following criteria:
//
// 1. Are for subresources (including nested frames).
@@ -678,7 +680,7 @@ void FrameFetchContext::upgradeInsecureRequest(FetchRequest& fetchRequest)
if (request.frameType() == WebURLRequest::FrameTypeNone
|| request.frameType() == WebURLRequest::FrameTypeNested
|| request.requestContext() == WebURLRequest::RequestContextForm
- || (!url.host().isNull() && m_document->insecureNavigationsToUpgrade()->contains(url.host().impl()->hash())))
+ || (!url.host().isNull() && relevantNavigationSet->contains(url.host().impl()->hash())))
{
UseCounter::count(m_document, UseCounter::UpgradeInsecureRequestsUpgradedRequest);
url.setProtocol("https");
« no previous file with comments | « third_party/WebKit/Source/core/loader/FormSubmission.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698