OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 { | 137 { |
138 visitor->trace(m_window); | 138 visitor->trace(m_window); |
139 FrameDestructionObserver::trace(visitor); | 139 FrameDestructionObserver::trace(visitor); |
140 } | 140 } |
141 | 141 |
142 void LocalDOMWindow::WindowFrameObserver::willDetachFrameHost() | 142 void LocalDOMWindow::WindowFrameObserver::willDetachFrameHost() |
143 { | 143 { |
144 m_window->willDetachFrameHost(); | 144 m_window->willDetachFrameHost(); |
145 } | 145 } |
146 | 146 |
| 147 void LocalDOMWindow::WindowFrameObserver::frameDestroyed() |
| 148 { |
| 149 m_window->frameDestroyed(); |
| 150 FrameDestructionObserver::frameDestroyed(); |
| 151 } |
| 152 |
147 class PostMessageTimer final : public NoBaseWillBeGarbageCollectedFinalized<Post
MessageTimer>, public SuspendableTimer { | 153 class PostMessageTimer final : public NoBaseWillBeGarbageCollectedFinalized<Post
MessageTimer>, public SuspendableTimer { |
148 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PostMessageTimer); | 154 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PostMessageTimer); |
149 public: | 155 public: |
150 PostMessageTimer(LocalDOMWindow& window, PassRefPtr<SerializedScriptValue> m
essage, const String& sourceOrigin, PassRefPtrWillBeRawPtr<LocalDOMWindow> sourc
e, PassOwnPtr<MessagePortChannelArray> channels, SecurityOrigin* targetOrigin, P
assRefPtrWillBeRawPtr<ScriptCallStack> stackTrace, UserGestureToken* userGesture
Token) | 156 PostMessageTimer(LocalDOMWindow& window, PassRefPtr<SerializedScriptValue> m
essage, const String& sourceOrigin, PassRefPtrWillBeRawPtr<LocalDOMWindow> sourc
e, PassOwnPtr<MessagePortChannelArray> channels, SecurityOrigin* targetOrigin, P
assRefPtrWillBeRawPtr<ScriptCallStack> stackTrace, UserGestureToken* userGesture
Token) |
151 : SuspendableTimer(window.document()) | 157 : SuspendableTimer(window.document()) |
152 , m_window(&window) | 158 , m_window(&window) |
153 , m_message(message) | 159 , m_message(message) |
154 , m_origin(sourceOrigin) | 160 , m_origin(sourceOrigin) |
155 , m_source(source) | 161 , m_source(source) |
156 , m_channels(channels) | 162 , m_channels(channels) |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 return frame() ? frame()->page() : nullptr; | 594 return frame() ? frame()->page() : nullptr; |
589 } | 595 } |
590 | 596 |
591 void LocalDOMWindow::willDetachFrameHost() | 597 void LocalDOMWindow::willDetachFrameHost() |
592 { | 598 { |
593 frame()->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); | 599 frame()->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); |
594 frame()->host()->consoleMessageStorage().frameWindowDiscarded(this); | 600 frame()->host()->consoleMessageStorage().frameWindowDiscarded(this); |
595 LocalDOMWindow::notifyContextDestroyed(); | 601 LocalDOMWindow::notifyContextDestroyed(); |
596 } | 602 } |
597 | 603 |
| 604 void LocalDOMWindow::frameDestroyed() |
| 605 { |
| 606 willDestroyDocumentInFrame(); |
| 607 m_properties.clear(); |
| 608 } |
| 609 |
598 void LocalDOMWindow::willDestroyDocumentInFrame() | 610 void LocalDOMWindow::willDestroyDocumentInFrame() |
599 { | 611 { |
600 for (const auto& domWindowProperty : m_properties) | 612 for (const auto& domWindowProperty : m_properties) |
601 domWindowProperty->willDestroyGlobalObjectInFrame(); | 613 domWindowProperty->willDestroyGlobalObjectInFrame(); |
602 } | 614 } |
603 | 615 |
604 void LocalDOMWindow::willDetachDocumentFromFrame() | 616 void LocalDOMWindow::willDetachDocumentFromFrame() |
605 { | 617 { |
606 for (const auto& domWindowProperty : m_properties) | 618 for (const auto& domWindowProperty : m_properties) |
607 domWindowProperty->willDetachGlobalObjectFromFrame(); | 619 domWindowProperty->willDetachGlobalObjectFromFrame(); |
608 } | 620 } |
609 | 621 |
610 void LocalDOMWindow::registerProperty(DOMWindowProperty* property) | 622 void LocalDOMWindow::registerProperty(DOMWindowProperty* property) |
611 { | 623 { |
612 m_properties.add(property); | 624 m_properties.add(property); |
613 } | 625 } |
614 | 626 |
615 void LocalDOMWindow::unregisterProperty(DOMWindowProperty* property) | 627 void LocalDOMWindow::unregisterProperty(DOMWindowProperty* property) |
616 { | 628 { |
617 m_properties.remove(property); | 629 m_properties.remove(property); |
618 } | 630 } |
619 | 631 |
620 void LocalDOMWindow::reset() | 632 void LocalDOMWindow::reset() |
621 { | 633 { |
622 willDestroyDocumentInFrame(); | 634 frameDestroyed(); |
623 m_properties.clear(); | |
624 | 635 |
625 m_screen = nullptr; | 636 m_screen = nullptr; |
626 m_history = nullptr; | 637 m_history = nullptr; |
627 m_locationbar = nullptr; | 638 m_locationbar = nullptr; |
628 m_menubar = nullptr; | 639 m_menubar = nullptr; |
629 m_personalbar = nullptr; | 640 m_personalbar = nullptr; |
630 m_scrollbars = nullptr; | 641 m_scrollbars = nullptr; |
631 m_statusbar = nullptr; | 642 m_statusbar = nullptr; |
632 m_toolbar = nullptr; | 643 m_toolbar = nullptr; |
633 m_console = nullptr; | 644 m_console = nullptr; |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1826 return m_frameObserver->frame(); | 1837 return m_frameObserver->frame(); |
1827 } | 1838 } |
1828 | 1839 |
1829 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) | 1840 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) |
1830 { | 1841 { |
1831 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. | 1842 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. |
1832 return v8::Handle<v8::Object>(); | 1843 return v8::Handle<v8::Object>(); |
1833 } | 1844 } |
1834 | 1845 |
1835 } // namespace blink | 1846 } // namespace blink |
OLD | NEW |