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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "bindings/core/v8/WindowProxyManager.h" | 9 #include "bindings/core/v8/WindowProxyManager.h" |
10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 has_suborigin ? security_origin->GetSuborigin()->GetName() : String(); | 216 has_suborigin ? security_origin->GetSuborigin()->GetName() : String(); |
217 | 217 |
218 KURL target_url = IsLocalDOMWindow() | 218 KURL target_url = IsLocalDOMWindow() |
219 ? blink::ToLocalDOMWindow(this)->document()->Url() | 219 ? blink::ToLocalDOMWindow(this)->document()->Url() |
220 : KURL(KURL(), GetFrame() | 220 : KURL(KURL(), GetFrame() |
221 ->GetSecurityContext() | 221 ->GetSecurityContext() |
222 ->GetSecurityOrigin() | 222 ->GetSecurityOrigin() |
223 ->ToString()); | 223 ->ToString()); |
224 if (MixedContentChecker::IsMixedContent(source_document->GetSecurityOrigin(), | 224 if (MixedContentChecker::IsMixedContent(source_document->GetSecurityOrigin(), |
225 target_url)) { | 225 target_url)) { |
226 UseCounter::Count(GetFrame(), UseCounter::kPostMessageFromSecureToInsecure); | 226 UseCounter::Count(source->GetFrame(), |
| 227 UseCounter::kPostMessageFromSecureToInsecure); |
227 } else if (MixedContentChecker::IsMixedContent( | 228 } else if (MixedContentChecker::IsMixedContent( |
228 GetFrame()->GetSecurityContext()->GetSecurityOrigin(), | 229 GetFrame()->GetSecurityContext()->GetSecurityOrigin(), |
229 source_document->Url())) { | 230 source_document->Url())) { |
230 UseCounter::Count(GetFrame(), UseCounter::kPostMessageFromInsecureToSecure); | 231 UseCounter::Count(source->GetFrame(), |
| 232 UseCounter::kPostMessageFromInsecureToSecure); |
231 if (MixedContentChecker::IsMixedContent( | 233 if (MixedContentChecker::IsMixedContent( |
232 GetFrame()->Tree().Top().GetSecurityContext()->GetSecurityOrigin(), | 234 GetFrame()->Tree().Top().GetSecurityContext()->GetSecurityOrigin(), |
233 source_document->Url())) { | 235 source_document->Url())) { |
234 UseCounter::Count(GetFrame(), | 236 UseCounter::Count(source->GetFrame(), |
235 UseCounter::kPostMessageFromInsecureToSecureToplevel); | 237 UseCounter::kPostMessageFromInsecureToSecureToplevel); |
236 } | 238 } |
237 } | 239 } |
238 | 240 |
239 if (!source_document->GetContentSecurityPolicy()->AllowConnectToSource( | 241 if (!source_document->GetContentSecurityPolicy()->AllowConnectToSource( |
240 target_url, RedirectStatus::kNoRedirect, | 242 target_url, RedirectStatus::kNoRedirect, |
241 SecurityViolationReportingPolicy::kSuppressReporting)) { | 243 SecurityViolationReportingPolicy::kSuppressReporting)) { |
242 UseCounter::Count( | 244 UseCounter::Count( |
243 GetFrame(), UseCounter::kPostMessageOutgoingWouldBeBlockedByConnectSrc); | 245 source->GetFrame(), |
| 246 UseCounter::kPostMessageOutgoingWouldBeBlockedByConnectSrc); |
244 } | 247 } |
245 | 248 |
246 MessageEvent* event = | 249 MessageEvent* event = |
247 MessageEvent::Create(std::move(channels), std::move(message), | 250 MessageEvent::Create(std::move(channels), std::move(message), |
248 source_origin, String(), source, source_suborigin); | 251 source_origin, String(), source, source_suborigin); |
249 | 252 |
250 SchedulePostMessage(event, std::move(target), source_document); | 253 SchedulePostMessage(event, std::move(target), source_document); |
251 } | 254 } |
252 | 255 |
253 // FIXME: Once we're throwing exceptions for cross-origin access violations, we | 256 // FIXME: Once we're throwing exceptions for cross-origin access violations, we |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 visitor->Trace(location_); | 458 visitor->Trace(location_); |
456 EventTargetWithInlineData::Trace(visitor); | 459 EventTargetWithInlineData::Trace(visitor); |
457 } | 460 } |
458 | 461 |
459 DEFINE_TRACE_WRAPPERS(DOMWindow) { | 462 DEFINE_TRACE_WRAPPERS(DOMWindow) { |
460 visitor->TraceWrappers(location_); | 463 visitor->TraceWrappers(location_); |
461 EventTargetWithInlineData::TraceWrappers(visitor); | 464 EventTargetWithInlineData::TraceWrappers(visitor); |
462 } | 465 } |
463 | 466 |
464 } // namespace blink | 467 } // namespace blink |
OLD | NEW |