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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 #include "core/events/DOMWindowEventQueue.h" | 52 #include "core/events/DOMWindowEventQueue.h" |
53 #include "core/events/EventListener.h" | 53 #include "core/events/EventListener.h" |
54 #include "core/events/HashChangeEvent.h" | 54 #include "core/events/HashChangeEvent.h" |
55 #include "core/events/MessageEvent.h" | 55 #include "core/events/MessageEvent.h" |
56 #include "core/events/PageTransitionEvent.h" | 56 #include "core/events/PageTransitionEvent.h" |
57 #include "core/events/PopStateEvent.h" | 57 #include "core/events/PopStateEvent.h" |
58 #include "core/frame/BarProp.h" | 58 #include "core/frame/BarProp.h" |
59 #include "core/frame/Console.h" | 59 #include "core/frame/Console.h" |
60 #include "core/frame/DOMPoint.h" | 60 #include "core/frame/DOMPoint.h" |
61 #include "core/frame/DOMWindowLifecycleNotifier.h" | 61 #include "core/frame/DOMWindowLifecycleNotifier.h" |
62 #include "core/frame/EventHandlerRegistry.h" | |
62 #include "core/frame/FrameConsole.h" | 63 #include "core/frame/FrameConsole.h" |
63 #include "core/frame/FrameHost.h" | 64 #include "core/frame/FrameHost.h" |
64 #include "core/frame/FrameView.h" | 65 #include "core/frame/FrameView.h" |
65 #include "core/frame/History.h" | 66 #include "core/frame/History.h" |
66 #include "core/frame/LocalFrame.h" | 67 #include "core/frame/LocalFrame.h" |
67 #include "core/frame/Location.h" | 68 #include "core/frame/Location.h" |
68 #include "core/frame/Navigator.h" | 69 #include "core/frame/Navigator.h" |
69 #include "core/frame/Screen.h" | 70 #include "core/frame/Screen.h" |
70 #include "core/frame/Settings.h" | 71 #include "core/frame/Settings.h" |
71 #include "core/html/HTMLFrameOwnerElement.h" | 72 #include "core/html/HTMLFrameOwnerElement.h" |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
322 } | 323 } |
323 | 324 |
324 DOMWindow::DOMWindow(LocalFrame& frame) | 325 DOMWindow::DOMWindow(LocalFrame& frame) |
325 : FrameDestructionObserver(&frame) | 326 : FrameDestructionObserver(&frame) |
326 , m_shouldPrintWhenFinishedLoading(false) | 327 , m_shouldPrintWhenFinishedLoading(false) |
327 #if ASSERT_ENABLED | 328 #if ASSERT_ENABLED |
328 , m_hasBeenReset(false) | 329 , m_hasBeenReset(false) |
329 #endif | 330 #endif |
330 { | 331 { |
331 ScriptWrappable::init(this); | 332 ScriptWrappable::init(this); |
333 m_frame->host()->eventHandlerRegistry().didMoveIntoFrameHost(*this); | |
Rick Byers
2014/05/06 20:54:39
Please add a comment describing why this is necess
Sami
2014/05/07 10:36:41
Yeah, I was thinking along the same lines -- it wo
Rick Byers
2014/05/07 13:28:21
Yeah this seems a lot cleaner. The observer abstr
| |
332 } | 334 } |
333 | 335 |
334 void DOMWindow::clearDocument() | 336 void DOMWindow::clearDocument() |
335 { | 337 { |
336 if (!m_document) | 338 if (!m_document) |
337 return; | 339 return; |
338 | 340 |
339 if (m_document->isActive()) { | 341 if (m_document->isActive()) { |
340 // FIXME: We don't call willRemove here. Why is that OK? | 342 // FIXME: We don't call willRemove here. Why is that OK? |
341 // This detach() call is also mostly redundant. Most of the calls to | 343 // This detach() call is also mostly redundant. Most of the calls to |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
477 enqueuePopstateEvent(stateObject); | 479 enqueuePopstateEvent(stateObject); |
478 else | 480 else |
479 m_pendingStateObject = stateObject; | 481 m_pendingStateObject = stateObject; |
480 } | 482 } |
481 | 483 |
482 DOMWindow::~DOMWindow() | 484 DOMWindow::~DOMWindow() |
483 { | 485 { |
484 ASSERT(m_hasBeenReset); | 486 ASSERT(m_hasBeenReset); |
485 reset(); | 487 reset(); |
486 | 488 |
489 if (m_frame && m_frame->host()) | |
490 m_frame->host()->eventHandlerRegistry().didMoveOutOfFrameHost(*this); | |
491 | |
487 removeAllEventListeners(); | 492 removeAllEventListeners(); |
488 | 493 |
489 ASSERT(m_document->isStopped()); | 494 ASSERT(m_document->isStopped()); |
490 clearDocument(); | 495 clearDocument(); |
491 } | 496 } |
492 | 497 |
493 const AtomicString& DOMWindow::interfaceName() const | 498 const AtomicString& DOMWindow::interfaceName() const |
494 { | 499 { |
495 return EventTargetNames::DOMWindow; | 500 return EventTargetNames::DOMWindow; |
496 } | 501 } |
(...skipping 17 matching lines...) Expand all Loading... | |
514 { | 519 { |
515 return frame() ? frame()->page() : 0; | 520 return frame() ? frame()->page() : 0; |
516 } | 521 } |
517 | 522 |
518 void DOMWindow::frameDestroyed() | 523 void DOMWindow::frameDestroyed() |
519 { | 524 { |
520 FrameDestructionObserver::frameDestroyed(); | 525 FrameDestructionObserver::frameDestroyed(); |
521 reset(); | 526 reset(); |
522 } | 527 } |
523 | 528 |
524 void DOMWindow::willDetachFrameHost() | 529 void DOMWindow::willDetachFrameHost() |
Rick Byers
2014/05/06 20:54:39
Does this only happen when a window is being destr
Sami
2014/05/07 10:36:41
I don't think we need to worry about that. If hand
Rick Byers
2014/05/07 13:28:21
Thanks, sounds reasonable.
| |
525 { | 530 { |
531 m_frame->host()->eventHandlerRegistry().didMoveOutOfFrameHost(*this); | |
526 InspectorInstrumentation::frameWindowDiscarded(m_frame, this); | 532 InspectorInstrumentation::frameWindowDiscarded(m_frame, this); |
527 } | 533 } |
528 | 534 |
529 void DOMWindow::willDestroyDocumentInFrame() | 535 void DOMWindow::willDestroyDocumentInFrame() |
530 { | 536 { |
531 // It is necessary to copy m_properties to a separate vector because the DOM WindowProperties may | 537 // It is necessary to copy m_properties to a separate vector because the DOM WindowProperties may |
532 // unregister themselves from the DOMWindow as a result of the call to willD estroyGlobalObjectInFrame. | 538 // unregister themselves from the DOMWindow as a result of the call to willD estroyGlobalObjectInFrame. |
533 Vector<DOMWindowProperty*> properties; | 539 Vector<DOMWindowProperty*> properties; |
534 copyToVector(m_properties, properties); | 540 copyToVector(m_properties, properties); |
535 for (size_t i = 0; i < properties.size(); ++i) | 541 for (size_t i = 0; i < properties.size(); ++i) |
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1865 visitor->trace(m_media); | 1871 visitor->trace(m_media); |
1866 visitor->trace(m_sessionStorage); | 1872 visitor->trace(m_sessionStorage); |
1867 visitor->trace(m_localStorage); | 1873 visitor->trace(m_localStorage); |
1868 visitor->trace(m_applicationCache); | 1874 visitor->trace(m_applicationCache); |
1869 visitor->trace(m_performance); | 1875 visitor->trace(m_performance); |
1870 visitor->trace(m_css); | 1876 visitor->trace(m_css); |
1871 WillBeHeapSupplementable<DOMWindow>::trace(visitor); | 1877 WillBeHeapSupplementable<DOMWindow>::trace(visitor); |
1872 } | 1878 } |
1873 | 1879 |
1874 } // namespace WebCore | 1880 } // namespace WebCore |
OLD | NEW |