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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 { | 477 { |
478 if (!ContextFeatures::pushStateEnabled(document())) | 478 if (!ContextFeatures::pushStateEnabled(document())) |
479 return; | 479 return; |
480 | 480 |
481 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=36202 Popstate event needs
to fire asynchronously | 481 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=36202 Popstate event needs
to fire asynchronously |
482 dispatchEvent(PopStateEvent::create(stateObject, &history())); | 482 dispatchEvent(PopStateEvent::create(stateObject, &history())); |
483 } | 483 } |
484 | 484 |
485 void LocalDOMWindow::statePopped(PassRefPtr<SerializedScriptValue> stateObject) | 485 void LocalDOMWindow::statePopped(PassRefPtr<SerializedScriptValue> stateObject) |
486 { | 486 { |
487 if (!frame()) | 487 if (!m_frame) |
488 return; | 488 return; |
489 | 489 |
490 // Per step 11 of section 6.5.9 (history traversal) of the HTML5 spec, we | 490 // Per step 11 of section 6.5.9 (history traversal) of the HTML5 spec, we |
491 // defer firing of popstate until we're in the complete state. | 491 // defer firing of popstate until we're in the complete state. |
492 if (document()->isLoadCompleted()) | 492 if (document()->isLoadCompleted()) |
493 enqueuePopstateEvent(stateObject); | 493 enqueuePopstateEvent(stateObject); |
494 else | 494 else |
495 m_pendingStateObject = stateObject; | 495 m_pendingStateObject = stateObject; |
496 } | 496 } |
497 | 497 |
498 LocalDOMWindow::~LocalDOMWindow() | 498 LocalDOMWindow::~LocalDOMWindow() |
499 { | 499 { |
500 ASSERT(m_hasBeenReset); | |
501 | |
502 #if ENABLE(OILPAN) | 500 #if ENABLE(OILPAN) |
503 // Oilpan: the frame host and document objects are | 501 // Oilpan: the frame host and document objects are |
504 // also garbage collected; cannot notify these | 502 // also garbage collected; cannot notify these |
505 // when removing event listeners. | 503 // when removing event listeners. |
506 removeAllEventListenersInternal(DoNotBroadcastListenerRemoval); | 504 removeAllEventListenersInternal(DoNotBroadcastListenerRemoval); |
507 | 505 |
508 // Cleared when detaching document. | 506 // Cleared when detaching document. |
509 ASSERT(!m_eventQueue); | 507 ASSERT(!m_eventQueue); |
510 #else | 508 #else |
| 509 ASSERT(m_hasBeenReset); |
511 reset(); | 510 reset(); |
512 | 511 |
513 removeAllEventListenersInternal(DoBroadcastListenerRemoval); | 512 removeAllEventListenersInternal(DoBroadcastListenerRemoval); |
514 | 513 |
515 ASSERT(m_document->isStopped()); | 514 ASSERT(m_document->isStopped()); |
516 clearDocument(); | 515 clearDocument(); |
517 #endif | 516 #endif |
518 } | 517 } |
519 | 518 |
520 const AtomicString& LocalDOMWindow::interfaceName() const | 519 const AtomicString& LocalDOMWindow::interfaceName() const |
(...skipping 14 matching lines...) Expand all Loading... |
535 PassRefPtrWillBeRawPtr<MediaQueryList> LocalDOMWindow::matchMedia(const String&
media) | 534 PassRefPtrWillBeRawPtr<MediaQueryList> LocalDOMWindow::matchMedia(const String&
media) |
536 { | 535 { |
537 return document() ? document()->mediaQueryMatcher().matchMedia(media) : null
ptr; | 536 return document() ? document()->mediaQueryMatcher().matchMedia(media) : null
ptr; |
538 } | 537 } |
539 | 538 |
540 Page* LocalDOMWindow::page() | 539 Page* LocalDOMWindow::page() |
541 { | 540 { |
542 return frame() ? frame()->page() : 0; | 541 return frame() ? frame()->page() : 0; |
543 } | 542 } |
544 | 543 |
545 void LocalDOMWindow::frameDestroyed() | |
546 { | |
547 FrameDestructionObserver::frameDestroyed(); | |
548 reset(); | |
549 } | |
550 | |
551 void LocalDOMWindow::willDetachFrameHost() | 544 void LocalDOMWindow::willDetachFrameHost() |
552 { | 545 { |
553 m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); | 546 m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); |
554 m_frame->console().messageStorage()->frameWindowDiscarded(this); | 547 m_frame->console().messageStorage()->frameWindowDiscarded(this); |
555 InspectorInstrumentation::frameWindowDiscarded(m_frame, this); | 548 InspectorInstrumentation::frameWindowDiscarded(m_frame, this); |
556 } | 549 } |
557 | 550 |
558 void LocalDOMWindow::willDestroyDocumentInFrame() | 551 void LocalDOMWindow::willDestroyDocumentInFrame() |
559 { | 552 { |
560 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<DOMWindowProperty> >::const_it
erator it = m_properties.begin(); it != m_properties.end(); ++it) | 553 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<DOMWindowProperty> >::const_it
erator it = m_properties.begin(); it != m_properties.end(); ++it) |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 frameConsole()->addMessage(consoleMessage.release()); | 889 frameConsole()->addMessage(consoleMessage.release()); |
897 return; | 890 return; |
898 } | 891 } |
899 } | 892 } |
900 | 893 |
901 dispatchEvent(event); | 894 dispatchEvent(event); |
902 } | 895 } |
903 | 896 |
904 DOMSelection* LocalDOMWindow::getSelection() | 897 DOMSelection* LocalDOMWindow::getSelection() |
905 { | 898 { |
906 if (!isCurrentlyDisplayedInFrame() || !m_frame) | 899 if (!isCurrentlyDisplayedInFrame()) |
907 return 0; | 900 return 0; |
908 | 901 |
909 return m_frame->document()->getSelection(); | 902 return m_frame->document()->getSelection(); |
910 } | 903 } |
911 | 904 |
912 Element* LocalDOMWindow::frameElement() const | 905 Element* LocalDOMWindow::frameElement() const |
913 { | 906 { |
914 if (!m_frame) | 907 if (!m_frame) |
915 return 0; | 908 return 0; |
916 | 909 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 | 1047 |
1055 return String(); | 1048 return String(); |
1056 } | 1049 } |
1057 | 1050 |
1058 bool LocalDOMWindow::find(const String& string, bool caseSensitive, bool backwar
ds, bool wrap, bool /*wholeWord*/, bool /*searchInFrames*/, bool /*showDialog*/)
const | 1051 bool LocalDOMWindow::find(const String& string, bool caseSensitive, bool backwar
ds, bool wrap, bool /*wholeWord*/, bool /*searchInFrames*/, bool /*showDialog*/)
const |
1059 { | 1052 { |
1060 if (!isCurrentlyDisplayedInFrame()) | 1053 if (!isCurrentlyDisplayedInFrame()) |
1061 return false; | 1054 return false; |
1062 | 1055 |
1063 // |m_frame| can be destructed during |Editor::findString()| via | 1056 // |m_frame| can be destructed during |Editor::findString()| via |
1064 // |Document::updateLayou()|, e.g. event handler removes a frame. | 1057 // |Document::updateLayout()|, e.g. event handler removes a frame. |
1065 RefPtr<LocalFrame> protectFrame(m_frame); | 1058 RefPtrWillBeRawPtr<LocalFrame> protectFrame(m_frame.get()); |
1066 | 1059 |
1067 // FIXME (13016): Support wholeWord, searchInFrames and showDialog | 1060 // FIXME (13016): Support wholeWord, searchInFrames and showDialog |
1068 return m_frame->editor().findString(string, !backwards, caseSensitive, wrap,
false); | 1061 return m_frame->editor().findString(string, !backwards, caseSensitive, wrap,
false); |
1069 } | 1062 } |
1070 | 1063 |
1071 bool LocalDOMWindow::offscreenBuffering() const | 1064 bool LocalDOMWindow::offscreenBuffering() const |
1072 { | 1065 { |
1073 return true; | 1066 return true; |
1074 } | 1067 } |
1075 | 1068 |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1857 LocalFrame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures, | 1850 LocalFrame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures, |
1858 *callingWindow, *firstFrame, *m_frame, function, functionContext); | 1851 *callingWindow, *firstFrame, *m_frame, function, functionContext); |
1859 if (!dialogFrame) | 1852 if (!dialogFrame) |
1860 return; | 1853 return; |
1861 UserGestureIndicatorDisabler disabler; | 1854 UserGestureIndicatorDisabler disabler; |
1862 dialogFrame->host()->chrome().runModal(); | 1855 dialogFrame->host()->chrome().runModal(); |
1863 } | 1856 } |
1864 | 1857 |
1865 LocalDOMWindow* LocalDOMWindow::anonymousIndexedGetter(uint32_t index) | 1858 LocalDOMWindow* LocalDOMWindow::anonymousIndexedGetter(uint32_t index) |
1866 { | 1859 { |
1867 LocalFrame* frame = this->frame(); | 1860 if (!m_frame) |
1868 if (!frame) | |
1869 return 0; | 1861 return 0; |
1870 | 1862 |
1871 Frame* child = frame->tree().scopedChild(index); | 1863 Frame* child = m_frame->tree().scopedChild(index); |
1872 if (child) | 1864 if (child) |
1873 return child->domWindow(); | 1865 return child->domWindow(); |
1874 | 1866 |
1875 return 0; | 1867 return 0; |
1876 } | 1868 } |
1877 | 1869 |
1878 DOMWindowLifecycleNotifier& LocalDOMWindow::lifecycleNotifier() | 1870 DOMWindowLifecycleNotifier& LocalDOMWindow::lifecycleNotifier() |
1879 { | 1871 { |
1880 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<LocalDOMWin
dow>::lifecycleNotifier()); | 1872 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<LocalDOMWin
dow>::lifecycleNotifier()); |
1881 } | 1873 } |
(...skipping 23 matching lines...) Expand all Loading... |
1905 visitor->trace(m_sessionStorage); | 1897 visitor->trace(m_sessionStorage); |
1906 visitor->trace(m_localStorage); | 1898 visitor->trace(m_localStorage); |
1907 visitor->trace(m_applicationCache); | 1899 visitor->trace(m_applicationCache); |
1908 visitor->trace(m_performance); | 1900 visitor->trace(m_performance); |
1909 visitor->trace(m_css); | 1901 visitor->trace(m_css); |
1910 visitor->trace(m_eventQueue); | 1902 visitor->trace(m_eventQueue); |
1911 #endif | 1903 #endif |
1912 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor); | 1904 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor); |
1913 EventTargetWithInlineData::trace(visitor); | 1905 EventTargetWithInlineData::trace(visitor); |
1914 LifecycleContext<LocalDOMWindow>::trace(visitor); | 1906 LifecycleContext<LocalDOMWindow>::trace(visitor); |
| 1907 FrameDestructionObserver::trace(visitor); |
1915 } | 1908 } |
1916 | 1909 |
1917 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) | 1910 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) |
1918 { | 1911 { |
1919 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. | 1912 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. |
1920 return v8::Handle<v8::Object>(); | 1913 return v8::Handle<v8::Object>(); |
1921 } | 1914 } |
1922 | 1915 |
1923 } // namespace blink | 1916 } // namespace blink |
OLD | NEW |