| 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 #ifndef DOMWindow_h | 5 #ifndef DOMWindow_h |
| 6 #define DOMWindow_h | 6 #define DOMWindow_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/Transferables.h" | 8 #include "bindings/core/v8/Transferables.h" |
| 9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
| 10 #include "core/events/EventTarget.h" | 10 #include "core/events/EventTarget.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 public: | 30 public: |
| 31 ~DOMWindow() override; | 31 ~DOMWindow() override; |
| 32 | 32 |
| 33 Frame* frame() const { | 33 Frame* frame() const { |
| 34 // A Frame is typically reused for navigations. If |m_frame| is not null, | 34 // A Frame is typically reused for navigations. If |m_frame| is not null, |
| 35 // two conditions must always be true: | 35 // two conditions must always be true: |
| 36 // - |m_frame->domWindow()| must point back to this DOMWindow. If it does | 36 // - |m_frame->domWindow()| must point back to this DOMWindow. If it does |
| 37 // not, it is easy to introduce a bug where script execution uses the | 37 // not, it is easy to introduce a bug where script execution uses the |
| 38 // wrong DOMWindow (which may be cross-origin). | 38 // wrong DOMWindow (which may be cross-origin). |
| 39 // - |m_frame| must be attached, i.e. |m_frame->host()| must not be null. | 39 // - |m_frame| must be attached, i.e. |m_frame->page()| must not be null. |
| 40 // If |m_frame->host()| is null, this indicates a bug where the frame was | 40 // If |m_frame->page()| is null, this indicates a bug where the frame was |
| 41 // detached but |m_frame| was not set to null. This bug can lead to | 41 // detached but |m_frame| was not set to null. This bug can lead to |
| 42 // issues where executing script incorrectly schedules work on a detached | 42 // issues where executing script incorrectly schedules work on a detached |
| 43 // frame. | 43 // frame. |
| 44 SECURITY_DCHECK(!m_frame || | 44 SECURITY_DCHECK(!m_frame || |
| 45 (m_frame->domWindow() == this && m_frame->host())); | 45 (m_frame->domWindow() == this && m_frame->page())); |
| 46 return m_frame; | 46 return m_frame; |
| 47 } | 47 } |
| 48 | 48 |
| 49 // GarbageCollectedFinalized overrides: | 49 // GarbageCollectedFinalized overrides: |
| 50 DECLARE_VIRTUAL_TRACE(); | 50 DECLARE_VIRTUAL_TRACE(); |
| 51 | 51 |
| 52 virtual bool isLocalDOMWindow() const = 0; | 52 virtual bool isLocalDOMWindow() const = 0; |
| 53 virtual bool isRemoteDOMWindow() const = 0; | 53 virtual bool isRemoteDOMWindow() const = 0; |
| 54 | 54 |
| 55 // ScriptWrappable overrides: | 55 // ScriptWrappable overrides: |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // only after the layout widget's deferred window close | 129 // only after the layout widget's deferred window close |
| 130 // operation has been performed, exposes (confusing) | 130 // operation has been performed, exposes (confusing) |
| 131 // implementation details to scripts. | 131 // implementation details to scripts. |
| 132 bool m_windowIsClosing; | 132 bool m_windowIsClosing; |
| 133 | 133 |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 } // namespace blink | 136 } // namespace blink |
| 137 | 137 |
| 138 #endif // DOMWindow_h | 138 #endif // DOMWindow_h |
| OLD | NEW |