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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/DOMWindow.h" 5 #include "core/frame/DOMWindow.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/ExceptionCode.h" 8 #include "core/dom/ExceptionCode.h"
9 #include "core/dom/ExecutionContext.h" 9 #include "core/dom/ExecutionContext.h"
10 #include "core/dom/SecurityContext.h" 10 #include "core/dom/SecurityContext.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 : securityOrigin->toString(); 226 : securityOrigin->toString();
227 String sourceSuborigin = 227 String sourceSuborigin =
228 hasSuborigin ? securityOrigin->suborigin()->name() : String(); 228 hasSuborigin ? securityOrigin->suborigin()->name() : String();
229 229
230 KURL targetUrl = 230 KURL targetUrl =
231 isLocalDOMWindow() 231 isLocalDOMWindow()
232 ? document()->url() 232 ? document()->url()
233 : KURL(KURL(), 233 : KURL(KURL(),
234 frame()->securityContext()->getSecurityOrigin()->toString()); 234 frame()->securityContext()->getSecurityOrigin()->toString());
235 if (MixedContentChecker::isMixedContent(sourceDocument->getSecurityOrigin(), 235 if (MixedContentChecker::isMixedContent(sourceDocument->getSecurityOrigin(),
236 targetUrl)) 236 targetUrl)) {
237 UseCounter::count(frame(), UseCounter::PostMessageFromSecureToInsecure); 237 UseCounter::count(frame(), UseCounter::PostMessageFromSecureToInsecure);
238 else if (MixedContentChecker::isMixedContent( 238 } else if (MixedContentChecker::isMixedContent(
239 frame()->securityContext()->getSecurityOrigin(), 239 frame()->securityContext()->getSecurityOrigin(),
240 sourceDocument->url())) 240 sourceDocument->url())) {
241 UseCounter::count(frame(), UseCounter::PostMessageFromInsecureToSecure); 241 UseCounter::count(frame(), UseCounter::PostMessageFromInsecureToSecure);
242 if (MixedContentChecker::isMixedContent(
243 frame()->tree().top()->securityContext()->getSecurityOrigin(),
244 sourceDocument->url())) {
245 UseCounter::count(frame(),
246 UseCounter::PostMessageFromInsecureToSecureToplevel);
247 }
248 }
242 249
243 MessageEvent* event = 250 MessageEvent* event =
244 MessageEvent::create(std::move(channels), std::move(message), 251 MessageEvent::create(std::move(channels), std::move(message),
245 sourceOrigin, String(), source, sourceSuborigin); 252 sourceOrigin, String(), source, sourceSuborigin);
246 253
247 schedulePostMessage(event, std::move(target), sourceDocument); 254 schedulePostMessage(event, std::move(target), sourceDocument);
248 } 255 }
249 256
250 // FIXME: Once we're throwing exceptions for cross-origin access violations, we 257 // FIXME: Once we're throwing exceptions for cross-origin access violations, we
251 // will always sanitize the target frame details, so we can safely combine 258 // will always sanitize the target frame details, so we can safely combine
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */); 443 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */);
437 } 444 }
438 445
439 DEFINE_TRACE(DOMWindow) { 446 DEFINE_TRACE(DOMWindow) {
440 visitor->trace(m_frame); 447 visitor->trace(m_frame);
441 visitor->trace(m_location); 448 visitor->trace(m_location);
442 EventTargetWithInlineData::trace(visitor); 449 EventTargetWithInlineData::trace(visitor);
443 } 450 }
444 451
445 } // namespace blink 452 } // namespace blink
OLDNEW
« 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