Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(900)

Side by Side Diff: Source/core/frame/LocalDOMWindow.cpp

Issue 879423003: Move Location to DOMWindow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: reset during willDetachFrameHost Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 584
585 Page* LocalDOMWindow::page() 585 Page* LocalDOMWindow::page()
586 { 586 {
587 return frame() ? frame()->page() : nullptr; 587 return frame() ? frame()->page() : nullptr;
588 } 588 }
589 589
590 void LocalDOMWindow::willDetachFrameHost() 590 void LocalDOMWindow::willDetachFrameHost()
591 { 591 {
592 frame()->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); 592 frame()->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this);
593 frame()->host()->consoleMessageStorage().frameWindowDiscarded(this); 593 frame()->host()->consoleMessageStorage().frameWindowDiscarded(this);
594 resetLocation();
594 LocalDOMWindow::notifyContextDestroyed(); 595 LocalDOMWindow::notifyContextDestroyed();
595 } 596 }
596 597
597 void LocalDOMWindow::willDestroyDocumentInFrame() 598 void LocalDOMWindow::willDestroyDocumentInFrame()
598 { 599 {
599 for (const auto& domWindowProperty : m_properties) 600 for (const auto& domWindowProperty : m_properties)
600 domWindowProperty->willDestroyGlobalObjectInFrame(); 601 domWindowProperty->willDestroyGlobalObjectInFrame();
601 } 602 }
602 603
603 void LocalDOMWindow::willDetachDocumentFromFrame() 604 void LocalDOMWindow::willDetachDocumentFromFrame()
(...skipping 21 matching lines...) Expand all
625 m_history = nullptr; 626 m_history = nullptr;
626 m_locationbar = nullptr; 627 m_locationbar = nullptr;
627 m_menubar = nullptr; 628 m_menubar = nullptr;
628 m_personalbar = nullptr; 629 m_personalbar = nullptr;
629 m_scrollbars = nullptr; 630 m_scrollbars = nullptr;
630 m_statusbar = nullptr; 631 m_statusbar = nullptr;
631 m_toolbar = nullptr; 632 m_toolbar = nullptr;
632 m_console = nullptr; 633 m_console = nullptr;
633 m_navigator = nullptr; 634 m_navigator = nullptr;
634 m_performance = nullptr; 635 m_performance = nullptr;
635 m_location = nullptr;
636 m_media = nullptr; 636 m_media = nullptr;
637 m_applicationCache = nullptr; 637 m_applicationCache = nullptr;
638 #if ENABLE(ASSERT) 638 #if ENABLE(ASSERT)
639 m_hasBeenReset = true; 639 m_hasBeenReset = true;
640 #endif 640 #endif
641 641
642 resetLocation();
643
642 LocalDOMWindow::notifyContextDestroyed(); 644 LocalDOMWindow::notifyContextDestroyed();
643 } 645 }
644 646
645 void LocalDOMWindow::sendOrientationChangeEvent() 647 void LocalDOMWindow::sendOrientationChangeEvent()
646 { 648 {
647 ASSERT(RuntimeEnabledFeatures::orientationEventEnabled()); 649 ASSERT(RuntimeEnabledFeatures::orientationEventEnabled());
648 650
649 // Before dispatching the event, build a list of the child frames to 651 // Before dispatching the event, build a list of the child frames to
650 // also send the event to, to mitigate side effects from event handlers 652 // also send the event to, to mitigate side effects from event handlers
651 // potentially interfering with others. 653 // potentially interfering with others.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 return m_navigator.get(); 767 return m_navigator.get();
766 } 768 }
767 769
768 Performance* LocalDOMWindow::performance() const 770 Performance* LocalDOMWindow::performance() const
769 { 771 {
770 if (!m_performance) 772 if (!m_performance)
771 m_performance = Performance::create(frame()); 773 m_performance = Performance::create(frame());
772 return m_performance.get(); 774 return m_performance.get();
773 } 775 }
774 776
775 Location* LocalDOMWindow::location() const
776 {
777 if (!m_location)
778 m_location = Location::create(frame());
779 return m_location.get();
780 }
781
782 void LocalDOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, cons t MessagePortArray* ports, const String& targetOrigin, LocalDOMWindow* source, E xceptionState& exceptionState) 777 void LocalDOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, cons t MessagePortArray* ports, const String& targetOrigin, LocalDOMWindow* source, E xceptionState& exceptionState)
783 { 778 {
784 if (!isCurrentlyDisplayedInFrame()) 779 if (!isCurrentlyDisplayedInFrame())
785 return; 780 return;
786 781
787 Document* sourceDocument = source->document(); 782 Document* sourceDocument = source->document();
788 783
789 // Compute the target origin. We need to do this synchronously in order 784 // Compute the target origin. We need to do this synchronously in order
790 // to generate the SyntaxError exception correctly. 785 // to generate the SyntaxError exception correctly.
791 RefPtr<SecurityOrigin> target; 786 RefPtr<SecurityOrigin> target;
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1814 visitor->trace(m_screen); 1809 visitor->trace(m_screen);
1815 visitor->trace(m_history); 1810 visitor->trace(m_history);
1816 visitor->trace(m_locationbar); 1811 visitor->trace(m_locationbar);
1817 visitor->trace(m_menubar); 1812 visitor->trace(m_menubar);
1818 visitor->trace(m_personalbar); 1813 visitor->trace(m_personalbar);
1819 visitor->trace(m_scrollbars); 1814 visitor->trace(m_scrollbars);
1820 visitor->trace(m_statusbar); 1815 visitor->trace(m_statusbar);
1821 visitor->trace(m_toolbar); 1816 visitor->trace(m_toolbar);
1822 visitor->trace(m_console); 1817 visitor->trace(m_console);
1823 visitor->trace(m_navigator); 1818 visitor->trace(m_navigator);
1824 visitor->trace(m_location);
1825 visitor->trace(m_media); 1819 visitor->trace(m_media);
1826 visitor->trace(m_applicationCache); 1820 visitor->trace(m_applicationCache);
1827 visitor->trace(m_performance); 1821 visitor->trace(m_performance);
1828 visitor->trace(m_css); 1822 visitor->trace(m_css);
1829 visitor->trace(m_eventQueue); 1823 visitor->trace(m_eventQueue);
1830 visitor->trace(m_postMessageTimers); 1824 visitor->trace(m_postMessageTimers);
1831 HeapSupplementable<LocalDOMWindow>::trace(visitor); 1825 HeapSupplementable<LocalDOMWindow>::trace(visitor);
1832 #endif 1826 #endif
1833 DOMWindow::trace(visitor); 1827 DOMWindow::trace(visitor);
1834 LifecycleContext<LocalDOMWindow>::trace(visitor); 1828 LifecycleContext<LocalDOMWindow>::trace(visitor);
1835 } 1829 }
1836 1830
1837 LocalFrame* LocalDOMWindow::frame() const 1831 LocalFrame* LocalDOMWindow::frame() const
1838 { 1832 {
1839 return m_frameObserver->frame(); 1833 return m_frameObserver->frame();
1840 } 1834 }
1841 1835
1842 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) 1836 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate)
1843 { 1837 {
1844 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. 1838 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8].
1845 return v8::Handle<v8::Object>(); 1839 return v8::Handle<v8::Object>();
1846 } 1840 }
1847 1841
1848 } // namespace blink 1842 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698