| 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 220 |
| 221 String sourceOrigin = (hasSuborigin && securityOrigin->suborigin()->policyCo
ntains(unsafeSendOpt)) ? securityOrigin->toPhysicalOriginString() : securityOrig
in->toString(); | 221 String sourceOrigin = (hasSuborigin && securityOrigin->suborigin()->policyCo
ntains(unsafeSendOpt)) ? securityOrigin->toPhysicalOriginString() : securityOrig
in->toString(); |
| 222 String sourceSuborigin = hasSuborigin ? securityOrigin->suborigin()->name()
: String(); | 222 String sourceSuborigin = hasSuborigin ? securityOrigin->suborigin()->name()
: String(); |
| 223 | 223 |
| 224 KURL targetUrl = isLocalDOMWindow() ? document()->url() : KURL(KURL(), frame
()->securityContext()->getSecurityOrigin()->toString()); | 224 KURL targetUrl = isLocalDOMWindow() ? document()->url() : KURL(KURL(), frame
()->securityContext()->getSecurityOrigin()->toString()); |
| 225 if (MixedContentChecker::isMixedContent(sourceDocument->getSecurityOrigin(),
targetUrl)) | 225 if (MixedContentChecker::isMixedContent(sourceDocument->getSecurityOrigin(),
targetUrl)) |
| 226 UseCounter::count(frame(), UseCounter::PostMessageFromSecureToInsecure); | 226 UseCounter::count(frame(), UseCounter::PostMessageFromSecureToInsecure); |
| 227 else if (MixedContentChecker::isMixedContent(frame()->securityContext()->get
SecurityOrigin(), sourceDocument->url())) | 227 else if (MixedContentChecker::isMixedContent(frame()->securityContext()->get
SecurityOrigin(), sourceDocument->url())) |
| 228 UseCounter::count(frame(), UseCounter::PostMessageFromInsecureToSecure); | 228 UseCounter::count(frame(), UseCounter::PostMessageFromInsecureToSecure); |
| 229 | 229 |
| 230 MessageEvent* event = MessageEvent::create(std::move(channels), message, sou
rceOrigin, String(), source, sourceSuborigin); | 230 MessageEvent* event = MessageEvent::create(std::move(channels), std::move(me
ssage), sourceOrigin, String(), source, sourceSuborigin); |
| 231 | 231 |
| 232 schedulePostMessage(event, std::move(target), sourceDocument); | 232 schedulePostMessage(event, std::move(target), sourceDocument); |
| 233 } | 233 } |
| 234 | 234 |
| 235 // FIXME: Once we're throwing exceptions for cross-origin access violations, we
will always sanitize the target | 235 // FIXME: Once we're throwing exceptions for cross-origin access violations, we
will always sanitize the target |
| 236 // frame details, so we can safely combine 'crossDomainAccessErrorMessage' with
this method after considering | 236 // frame details, so we can safely combine 'crossDomainAccessErrorMessage' with
this method after considering |
| 237 // exactly which details may be exposed to JavaScript. | 237 // exactly which details may be exposed to JavaScript. |
| 238 // | 238 // |
| 239 // http://crbug.com/17325 | 239 // http://crbug.com/17325 |
| 240 String DOMWindow::sanitizedCrossDomainAccessErrorMessage(const LocalDOMWindow* c
allingWindow) const | 240 String DOMWindow::sanitizedCrossDomainAccessErrorMessage(const LocalDOMWindow* c
allingWindow) const |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */
); | 375 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */
); |
| 376 } | 376 } |
| 377 | 377 |
| 378 DEFINE_TRACE(DOMWindow) | 378 DEFINE_TRACE(DOMWindow) |
| 379 { | 379 { |
| 380 visitor->trace(m_location); | 380 visitor->trace(m_location); |
| 381 EventTargetWithInlineData::trace(visitor); | 381 EventTargetWithInlineData::trace(visitor); |
| 382 } | 382 } |
| 383 | 383 |
| 384 } // namespace blink | 384 } // namespace blink |
| OLD | NEW |