| 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 #include "core/dom/Document.h" | 8 #include "core/dom/Document.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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } | 108 } |
| 109 | 109 |
| 110 DOMWindow* DOMWindow::AnonymousIndexedGetter(uint32_t index) const { | 110 DOMWindow* DOMWindow::AnonymousIndexedGetter(uint32_t index) const { |
| 111 if (!GetFrame()) | 111 if (!GetFrame()) |
| 112 return nullptr; | 112 return nullptr; |
| 113 | 113 |
| 114 Frame* child = GetFrame()->Tree().ScopedChild(index); | 114 Frame* child = GetFrame()->Tree().ScopedChild(index); |
| 115 return child ? child->DomWindow() : nullptr; | 115 return child ? child->DomWindow() : nullptr; |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool DOMWindow::AnonymousIndexedSetter(uint32_t index, |
| 119 const ScriptValue& value) { |
| 120 // https://html.spec.whatwg.org/C/browsers.html#windowproxy-defineownproperty |
| 121 // step 2 - 1. If P is an array index property name, return false. |
| 122 // |
| 123 // As an alternative way to implement WindowProxy.[[DefineOwnProperty]] for |
| 124 // array index property names, we always intercept and ignore the set |
| 125 // operation for indexed properties, i.e. [[DefineOwnProperty]] for array |
| 126 // index property names has always no effect. |
| 127 return true; // Intercept unconditionally but do nothing. |
| 128 } |
| 129 |
| 118 bool DOMWindow::IsCurrentlyDisplayedInFrame() const { | 130 bool DOMWindow::IsCurrentlyDisplayedInFrame() const { |
| 119 if (GetFrame()) | 131 if (GetFrame()) |
| 120 SECURITY_CHECK(GetFrame()->DomWindow() == this); | 132 SECURITY_CHECK(GetFrame()->DomWindow() == this); |
| 121 return GetFrame() && GetFrame()->GetPage(); | 133 return GetFrame() && GetFrame()->GetPage(); |
| 122 } | 134 } |
| 123 | 135 |
| 124 bool DOMWindow::IsInsecureScriptAccess(LocalDOMWindow& calling_window, | 136 bool DOMWindow::IsInsecureScriptAccess(LocalDOMWindow& calling_window, |
| 125 const KURL& url) { | 137 const KURL& url) { |
| 126 if (!url.ProtocolIsJavaScript()) | 138 if (!url.ProtocolIsJavaScript()) |
| 127 return false; | 139 return false; |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 } | 439 } |
| 428 | 440 |
| 429 DEFINE_TRACE(DOMWindow) { | 441 DEFINE_TRACE(DOMWindow) { |
| 430 visitor->Trace(frame_); | 442 visitor->Trace(frame_); |
| 431 visitor->Trace(input_capabilities_); | 443 visitor->Trace(input_capabilities_); |
| 432 visitor->Trace(location_); | 444 visitor->Trace(location_); |
| 433 EventTargetWithInlineData::Trace(visitor); | 445 EventTargetWithInlineData::Trace(visitor); |
| 434 } | 446 } |
| 435 | 447 |
| 436 } // namespace blink | 448 } // namespace blink |
| OLD | NEW |