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

Unified Diff: third_party/WebKit/Source/core/frame/Frame.cpp

Issue 2557063002: Upgrade Insecure Requests: bugfixes, tests, and support for OOPIF.
Patch Set: Addressed comments (@nasko #2). 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/Frame.h ('k') | third_party/WebKit/Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/Frame.cpp
diff --git a/third_party/WebKit/Source/core/frame/Frame.cpp b/third_party/WebKit/Source/core/frame/Frame.cpp
index 9680704918860464f3f63c78c599744ecda86538..84cf8593da2888411590cc2022cc996dccadf5cf 100644
--- a/third_party/WebKit/Source/core/frame/Frame.cpp
+++ b/third_party/WebKit/Source/core/frame/Frame.cpp
@@ -334,6 +334,32 @@ void Frame::didChangeVisibilityState() {
childFrames[i]->didChangeVisibilityState();
}
+// static
+void Frame::upgradeInsecureRequest(KURL& url, Document& originDocument) {
+ // We always upgrade requests that meet any of the following criteria:
+ //
+ // Enforced in FrameLoader::upgradeInsecureRequest.
+ // 1. Are for subresources.
+ // 2. Are for nested frames.
+ // 3. Are form submissions.
+ // 4. Whose hosts are contained in the originDocument's upgrade insecure
+ // navigations set. (same-frame navigation).
+ // Enforced in Frame::upgradeInsecureRequest.
+ // 4. Whose hosts are contained in the originDocument's upgrade insecure
+ // navigations set. (cross-frame navigation).
+ if (url.protocolIs("http") &&
+ originDocument.getInsecureRequestPolicy() & kUpgradeInsecureRequests &&
+ !url.host().isNull() &&
+ originDocument.insecureNavigationsToUpgrade()->contains(
+ url.host().impl()->hash())) {
+ UseCounter::count(originDocument,
+ UseCounter::UpgradeInsecureRequestsUpgradedRequest);
+ url.setProtocol("https");
+ if (url.port() == 80)
+ url.setPort(443);
+ }
+}
+
Frame::Frame(FrameClient* client, FrameHost* host, FrameOwner* owner)
: m_treeNode(this),
m_host(host),
@@ -349,5 +375,4 @@ Frame::Frame(FrameClient* client, FrameHost* host, FrameOwner* owner)
else
page()->setMainFrame(this);
}
-
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/frame/Frame.h ('k') | third_party/WebKit/Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698