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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 return frame() ? frame()->page() : nullptr; | 593 return frame() ? frame()->page() : nullptr; |
588 } | 594 } |
589 | 595 |
590 void LocalDOMWindow::willDetachFrameHost() | 596 void LocalDOMWindow::willDetachFrameHost() |
591 { | 597 { |
592 frame()->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); | 598 frame()->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); |
593 frame()->host()->consoleMessageStorage().frameWindowDiscarded(this); | 599 frame()->host()->consoleMessageStorage().frameWindowDiscarded(this); |
594 LocalDOMWindow::notifyContextDestroyed(); | 600 LocalDOMWindow::notifyContextDestroyed(); |
595 } | 601 } |
596 | 602 |
| 603 void LocalDOMWindow::frameDestroyed() |
| 604 { |
| 605 willDestroyDocumentInFrame(); |
| 606 m_properties.clear(); |
| 607 } |
| 608 |
597 void LocalDOMWindow::willDestroyDocumentInFrame() | 609 void LocalDOMWindow::willDestroyDocumentInFrame() |
598 { | 610 { |
599 for (const auto& domWindowProperty : m_properties) | 611 for (const auto& domWindowProperty : m_properties) |
600 domWindowProperty->willDestroyGlobalObjectInFrame(); | 612 domWindowProperty->willDestroyGlobalObjectInFrame(); |
601 } | 613 } |
602 | 614 |
603 void LocalDOMWindow::willDetachDocumentFromFrame() | 615 void LocalDOMWindow::willDetachDocumentFromFrame() |
604 { | 616 { |
605 for (const auto& domWindowProperty : m_properties) | 617 for (const auto& domWindowProperty : m_properties) |
606 domWindowProperty->willDetachGlobalObjectFromFrame(); | 618 domWindowProperty->willDetachGlobalObjectFromFrame(); |
607 } | 619 } |
608 | 620 |
609 void LocalDOMWindow::registerProperty(DOMWindowProperty* property) | 621 void LocalDOMWindow::registerProperty(DOMWindowProperty* property) |
610 { | 622 { |
611 m_properties.add(property); | 623 m_properties.add(property); |
612 } | 624 } |
613 | 625 |
614 void LocalDOMWindow::unregisterProperty(DOMWindowProperty* property) | 626 void LocalDOMWindow::unregisterProperty(DOMWindowProperty* property) |
615 { | 627 { |
616 m_properties.remove(property); | 628 m_properties.remove(property); |
617 } | 629 } |
618 | 630 |
619 void LocalDOMWindow::reset() | 631 void LocalDOMWindow::reset() |
620 { | 632 { |
621 willDestroyDocumentInFrame(); | 633 frameDestroyed(); |
622 m_properties.clear(); | |
623 | 634 |
624 m_screen = nullptr; | 635 m_screen = nullptr; |
625 m_history = nullptr; | 636 m_history = nullptr; |
626 m_locationbar = nullptr; | 637 m_locationbar = nullptr; |
627 m_menubar = nullptr; | 638 m_menubar = nullptr; |
628 m_personalbar = nullptr; | 639 m_personalbar = nullptr; |
629 m_scrollbars = nullptr; | 640 m_scrollbars = nullptr; |
630 m_statusbar = nullptr; | 641 m_statusbar = nullptr; |
631 m_toolbar = nullptr; | 642 m_toolbar = nullptr; |
632 m_console = nullptr; | 643 m_console = nullptr; |
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 return m_frameObserver->frame(); | 1858 return m_frameObserver->frame(); |
1848 } | 1859 } |
1849 | 1860 |
1850 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) | 1861 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) |
1851 { | 1862 { |
1852 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. | 1863 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. |
1853 return v8::Handle<v8::Object>(); | 1864 return v8::Handle<v8::Object>(); |
1854 } | 1865 } |
1855 | 1866 |
1856 } // namespace blink | 1867 } // namespace blink |
OLD | NEW |