| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 111 } |
| 112 | 112 |
| 113 DOMWindow* DOMWindow::AnonymousIndexedGetter(uint32_t index) const { | 113 DOMWindow* DOMWindow::AnonymousIndexedGetter(uint32_t index) const { |
| 114 if (!GetFrame()) | 114 if (!GetFrame()) |
| 115 return nullptr; | 115 return nullptr; |
| 116 | 116 |
| 117 Frame* child = GetFrame()->Tree().ScopedChild(index); | 117 Frame* child = GetFrame()->Tree().ScopedChild(index); |
| 118 return child ? child->DomWindow() : nullptr; | 118 return child ? child->DomWindow() : nullptr; |
| 119 } | 119 } |
| 120 | 120 |
| 121 bool DOMWindow::AnonymousIndexedSetter(uint32_t index, | |
| 122 const ScriptValue& value) { | |
| 123 // https://html.spec.whatwg.org/C/browsers.html#windowproxy-defineownproperty | |
| 124 // step 2 - 1. If P is an array index property name, return false. | |
| 125 // | |
| 126 // As an alternative way to implement WindowProxy.[[DefineOwnProperty]] for | |
| 127 // array index property names, we always intercept and ignore the set | |
| 128 // operation for indexed properties, i.e. [[DefineOwnProperty]] for array | |
| 129 // index property names has always no effect. | |
| 130 return true; // Intercept unconditionally but do nothing. | |
| 131 } | |
| 132 | |
| 133 bool DOMWindow::IsCurrentlyDisplayedInFrame() const { | 121 bool DOMWindow::IsCurrentlyDisplayedInFrame() const { |
| 134 if (GetFrame()) | 122 if (GetFrame()) |
| 135 SECURITY_CHECK(GetFrame()->DomWindow() == this); | 123 SECURITY_CHECK(GetFrame()->DomWindow() == this); |
| 136 return GetFrame() && GetFrame()->GetPage(); | 124 return GetFrame() && GetFrame()->GetPage(); |
| 137 } | 125 } |
| 138 | 126 |
| 139 bool DOMWindow::IsInsecureScriptAccess(LocalDOMWindow& calling_window, | 127 bool DOMWindow::IsInsecureScriptAccess(LocalDOMWindow& calling_window, |
| 140 const KURL& url) { | 128 const KURL& url) { |
| 141 if (!url.ProtocolIsJavaScript()) | 129 if (!url.ProtocolIsJavaScript()) |
| 142 return false; | 130 return false; |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 visitor->Trace(location_); | 446 visitor->Trace(location_); |
| 459 EventTargetWithInlineData::Trace(visitor); | 447 EventTargetWithInlineData::Trace(visitor); |
| 460 } | 448 } |
| 461 | 449 |
| 462 DEFINE_TRACE_WRAPPERS(DOMWindow) { | 450 DEFINE_TRACE_WRAPPERS(DOMWindow) { |
| 463 visitor->TraceWrappers(location_); | 451 visitor->TraceWrappers(location_); |
| 464 EventTargetWithInlineData::TraceWrappers(visitor); | 452 EventTargetWithInlineData::TraceWrappers(visitor); |
| 465 } | 453 } |
| 466 | 454 |
| 467 } // namespace blink | 455 } // namespace blink |
| OLD | NEW |