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

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

Issue 2651593003: Add a counter for postMessage from insecure to secure top-level frames (Closed)
Patch Set: updates Created 3 years, 11 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 | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/DOMWindow.cpp
diff --git a/third_party/WebKit/Source/core/frame/DOMWindow.cpp b/third_party/WebKit/Source/core/frame/DOMWindow.cpp
index 3e4723950ddf5d5b5f8e47f46bf2669a907f6d40..0e1a26b4d379bedfb6bfdf6c5dc41218824f628f 100644
--- a/third_party/WebKit/Source/core/frame/DOMWindow.cpp
+++ b/third_party/WebKit/Source/core/frame/DOMWindow.cpp
@@ -233,12 +233,19 @@ void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message,
: KURL(KURL(),
frame()->securityContext()->getSecurityOrigin()->toString());
if (MixedContentChecker::isMixedContent(sourceDocument->getSecurityOrigin(),
- targetUrl))
+ targetUrl)) {
UseCounter::count(frame(), UseCounter::PostMessageFromSecureToInsecure);
- else if (MixedContentChecker::isMixedContent(
- frame()->securityContext()->getSecurityOrigin(),
- sourceDocument->url()))
+ } else if (MixedContentChecker::isMixedContent(
+ frame()->securityContext()->getSecurityOrigin(),
+ sourceDocument->url())) {
UseCounter::count(frame(), UseCounter::PostMessageFromInsecureToSecure);
+ if (MixedContentChecker::isMixedContent(
+ frame()->tree().top()->securityContext()->getSecurityOrigin(),
+ sourceDocument->url())) {
+ UseCounter::count(frame(),
+ UseCounter::PostMessageFromInsecureToSecureToplevel);
+ }
+ }
MessageEvent* event =
MessageEvent::create(std::move(channels), std::move(message),
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698