Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 (frame()->isMainFrame()) { | |
|
Mike West
2017/01/23 08:59:22
That is, I think the goal of the counter is to det
| |
| 243 UseCounter::count(frame(), | |
| 244 UseCounter::PostMessageFromInsecureToSecureToplevel); | |
| 245 } | |
| 246 } | |
| 242 | 247 |
| 243 MessageEvent* event = | 248 MessageEvent* event = |
| 244 MessageEvent::create(std::move(channels), std::move(message), | 249 MessageEvent::create(std::move(channels), std::move(message), |
| 245 sourceOrigin, String(), source, sourceSuborigin); | 250 sourceOrigin, String(), source, sourceSuborigin); |
| 246 | 251 |
| 247 schedulePostMessage(event, std::move(target), sourceDocument); | 252 schedulePostMessage(event, std::move(target), sourceDocument); |
| 248 } | 253 } |
| 249 | 254 |
| 250 // FIXME: Once we're throwing exceptions for cross-origin access violations, we | 255 // 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 | 256 // will always sanitize the target frame details, so we can safely combine |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */); | 441 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */); |
| 437 } | 442 } |
| 438 | 443 |
| 439 DEFINE_TRACE(DOMWindow) { | 444 DEFINE_TRACE(DOMWindow) { |
| 440 visitor->trace(m_frame); | 445 visitor->trace(m_frame); |
| 441 visitor->trace(m_location); | 446 visitor->trace(m_location); |
| 442 EventTargetWithInlineData::trace(visitor); | 447 EventTargetWithInlineData::trace(visitor); |
| 443 } | 448 } |
| 444 | 449 |
| 445 } // namespace blink | 450 } // namespace blink |
| OLD | NEW |