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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
476 { | 476 { |
477 if (!ContextFeatures::pushStateEnabled(document())) | 477 if (!ContextFeatures::pushStateEnabled(document())) |
478 return; | 478 return; |
479 | 479 |
480 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=36202 Popstate event needs to fire asynchronously | 480 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=36202 Popstate event needs to fire asynchronously |
481 dispatchEvent(PopStateEvent::create(stateObject, &history())); | 481 dispatchEvent(PopStateEvent::create(stateObject, &history())); |
482 } | 482 } |
483 | 483 |
484 void LocalDOMWindow::statePopped(PassRefPtr<SerializedScriptValue> stateObject) | 484 void LocalDOMWindow::statePopped(PassRefPtr<SerializedScriptValue> stateObject) |
485 { | 485 { |
486 if (!frame()) | 486 if (!m_frame) |
487 return; | 487 return; |
488 | 488 |
489 // Per step 11 of section 6.5.9 (history traversal) of the HTML5 spec, we | 489 // Per step 11 of section 6.5.9 (history traversal) of the HTML5 spec, we |
490 // defer firing of popstate until we're in the complete state. | 490 // defer firing of popstate until we're in the complete state. |
491 if (document()->isLoadCompleted()) | 491 if (document()->isLoadCompleted()) |
492 enqueuePopstateEvent(stateObject); | 492 enqueuePopstateEvent(stateObject); |
493 else | 493 else |
494 m_pendingStateObject = stateObject; | 494 m_pendingStateObject = stateObject; |
495 } | 495 } |
496 | 496 |
497 LocalDOMWindow::~LocalDOMWindow() | 497 LocalDOMWindow::~LocalDOMWindow() |
498 { | 498 { |
499 ASSERT(m_hasBeenReset); | |
500 | |
501 #if ENABLE(OILPAN) | 499 #if ENABLE(OILPAN) |
502 // Oilpan: the frame host and document objects are | 500 // Oilpan: the frame host and document objects are |
503 // also garbage collected; cannot notify these | 501 // also garbage collected; cannot notify these |
504 // when removing event listeners. | 502 // when removing event listeners. |
505 removeAllEventListenersInternal(DoNotBroadcastListenerRemoval); | 503 removeAllEventListenersInternal(DoNotBroadcastListenerRemoval); |
506 | 504 |
507 // Cleared when detaching document. | 505 // Cleared when detaching document. |
508 ASSERT(!m_eventQueue); | 506 ASSERT(!m_eventQueue); |
509 #else | 507 #else |
508 ASSERT(m_hasBeenReset); | |
510 reset(); | 509 reset(); |
511 | 510 |
512 removeAllEventListenersInternal(DoBroadcastListenerRemoval); | 511 removeAllEventListenersInternal(DoBroadcastListenerRemoval); |
513 | 512 |
514 ASSERT(m_document->isStopped()); | 513 ASSERT(m_document->isStopped()); |
515 clearDocument(); | 514 clearDocument(); |
516 #endif | 515 #endif |
517 } | 516 } |
518 | 517 |
519 const AtomicString& LocalDOMWindow::interfaceName() const | 518 const AtomicString& LocalDOMWindow::interfaceName() const |
(...skipping 14 matching lines...) Expand all Loading... | |
534 PassRefPtrWillBeRawPtr<MediaQueryList> LocalDOMWindow::matchMedia(const String& media) | 533 PassRefPtrWillBeRawPtr<MediaQueryList> LocalDOMWindow::matchMedia(const String& media) |
535 { | 534 { |
536 return document() ? document()->mediaQueryMatcher().matchMedia(media) : null ptr; | 535 return document() ? document()->mediaQueryMatcher().matchMedia(media) : null ptr; |
537 } | 536 } |
538 | 537 |
539 Page* LocalDOMWindow::page() | 538 Page* LocalDOMWindow::page() |
540 { | 539 { |
541 return frame() ? frame()->page() : 0; | 540 return frame() ? frame()->page() : 0; |
542 } | 541 } |
543 | 542 |
543 #if !ENABLE(OILPAN) | |
544 void LocalDOMWindow::frameDestroyed() | 544 void LocalDOMWindow::frameDestroyed() |
545 { | 545 { |
546 FrameDestructionObserver::frameDestroyed(); | 546 FrameDestructionObserver::frameDestroyed(); |
547 reset(); | 547 reset(); |
haraken
2014/09/11 14:47:25
Sorry for asking a similar question (c.f., https:/
sof
2014/09/12 17:08:40
I think calling reset() at all here is questionabl
sof
2014/09/14 06:48:48
There's actually no need to do any resetting here,
| |
548 } | 548 } |
549 #endif | |
549 | 550 |
550 void LocalDOMWindow::willDetachFrameHost() | 551 void LocalDOMWindow::willDetachFrameHost() |
551 { | 552 { |
552 m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); | 553 m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); |
553 m_frame->console().messageStorage()->frameWindowDiscarded(this); | 554 m_frame->console().messageStorage()->frameWindowDiscarded(this); |
554 InspectorInstrumentation::frameWindowDiscarded(m_frame, this); | 555 InspectorInstrumentation::frameWindowDiscarded(m_frame, this); |
555 } | 556 } |
556 | 557 |
557 void LocalDOMWindow::willDestroyDocumentInFrame() | 558 void LocalDOMWindow::willDestroyDocumentInFrame() |
558 { | 559 { |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
889 frameConsole()->addMessage(consoleMessage.release()); | 890 frameConsole()->addMessage(consoleMessage.release()); |
890 return; | 891 return; |
891 } | 892 } |
892 } | 893 } |
893 | 894 |
894 dispatchEvent(event); | 895 dispatchEvent(event); |
895 } | 896 } |
896 | 897 |
897 DOMSelection* LocalDOMWindow::getSelection() | 898 DOMSelection* LocalDOMWindow::getSelection() |
898 { | 899 { |
899 if (!isCurrentlyDisplayedInFrame() || !m_frame) | 900 if (!isCurrentlyDisplayedInFrame()) |
900 return 0; | 901 return 0; |
901 | 902 |
902 return m_frame->document()->getSelection(); | 903 return m_frame->document()->getSelection(); |
903 } | 904 } |
904 | 905 |
905 Element* LocalDOMWindow::frameElement() const | 906 Element* LocalDOMWindow::frameElement() const |
906 { | 907 { |
907 if (!m_frame) | 908 if (!m_frame) |
908 return 0; | 909 return 0; |
909 | 910 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1047 | 1048 |
1048 return String(); | 1049 return String(); |
1049 } | 1050 } |
1050 | 1051 |
1051 bool LocalDOMWindow::find(const String& string, bool caseSensitive, bool backwar ds, bool wrap, bool /*wholeWord*/, bool /*searchInFrames*/, bool /*showDialog*/) const | 1052 bool LocalDOMWindow::find(const String& string, bool caseSensitive, bool backwar ds, bool wrap, bool /*wholeWord*/, bool /*searchInFrames*/, bool /*showDialog*/) const |
1052 { | 1053 { |
1053 if (!isCurrentlyDisplayedInFrame()) | 1054 if (!isCurrentlyDisplayedInFrame()) |
1054 return false; | 1055 return false; |
1055 | 1056 |
1056 // |m_frame| can be destructed during |Editor::findString()| via | 1057 // |m_frame| can be destructed during |Editor::findString()| via |
1057 // |Document::updateLayou()|, e.g. event handler removes a frame. | 1058 // |Document::updateLayout()|, e.g. event handler removes a frame. |
1058 RefPtr<LocalFrame> protectFrame(m_frame); | 1059 RefPtrWillBeRawPtr<LocalFrame> protectFrame(m_frame.get()); |
1059 | 1060 |
1060 // FIXME (13016): Support wholeWord, searchInFrames and showDialog | 1061 // FIXME (13016): Support wholeWord, searchInFrames and showDialog |
1061 return m_frame->editor().findString(string, !backwards, caseSensitive, wrap, false); | 1062 return m_frame->editor().findString(string, !backwards, caseSensitive, wrap, false); |
1062 } | 1063 } |
1063 | 1064 |
1064 bool LocalDOMWindow::offscreenBuffering() const | 1065 bool LocalDOMWindow::offscreenBuffering() const |
1065 { | 1066 { |
1066 return true; | 1067 return true; |
1067 } | 1068 } |
1068 | 1069 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1181 if (!view) | 1182 if (!view) |
1182 return 0; | 1183 return 0; |
1183 | 1184 |
1184 m_frame->document()->updateLayoutIgnorePendingStylesheets(); | 1185 m_frame->document()->updateLayoutIgnorePendingStylesheets(); |
1185 | 1186 |
1186 return adjustForAbsoluteZoom(view->scrollY(), m_frame->pageZoomFactor()); | 1187 return adjustForAbsoluteZoom(view->scrollY(), m_frame->pageZoomFactor()); |
1187 } | 1188 } |
1188 | 1189 |
1189 bool LocalDOMWindow::closed() const | 1190 bool LocalDOMWindow::closed() const |
1190 { | 1191 { |
1191 return !m_frame; | 1192 // FIXME: Oilpan: the timing of when m_frame is GCed is clearly |
1193 // different to what happens non-Oilpan. m_frame->hasBeenClosed() | |
1194 // is considered in both settings to make the behavior the same -- | |
1195 // the flag is set when the WebView (and frame) is closed. Finalization | |
1196 // of the m_frame will happen at some point later. | |
1197 // | |
1198 return !m_frame || m_frame->hasBeenClosed(); | |
1192 } | 1199 } |
1193 | 1200 |
1194 unsigned LocalDOMWindow::length() const | 1201 unsigned LocalDOMWindow::length() const |
1195 { | 1202 { |
1196 if (!isCurrentlyDisplayedInFrame()) | 1203 if (!isCurrentlyDisplayedInFrame()) |
1197 return 0; | 1204 return 0; |
1198 | 1205 |
1199 return m_frame->tree().scopedChildCount(); | 1206 return m_frame->tree().scopedChildCount(); |
1200 } | 1207 } |
1201 | 1208 |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1850 LocalFrame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures, | 1857 LocalFrame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures, |
1851 *callingWindow, *firstFrame, *m_frame, function, functionContext); | 1858 *callingWindow, *firstFrame, *m_frame, function, functionContext); |
1852 if (!dialogFrame) | 1859 if (!dialogFrame) |
1853 return; | 1860 return; |
1854 UserGestureIndicatorDisabler disabler; | 1861 UserGestureIndicatorDisabler disabler; |
1855 dialogFrame->host()->chrome().runModal(); | 1862 dialogFrame->host()->chrome().runModal(); |
1856 } | 1863 } |
1857 | 1864 |
1858 LocalDOMWindow* LocalDOMWindow::anonymousIndexedGetter(uint32_t index) | 1865 LocalDOMWindow* LocalDOMWindow::anonymousIndexedGetter(uint32_t index) |
1859 { | 1866 { |
1860 LocalFrame* frame = this->frame(); | 1867 if (!m_frame) |
1861 if (!frame) | |
1862 return 0; | 1868 return 0; |
1863 | 1869 |
1864 Frame* child = frame->tree().scopedChild(index); | 1870 Frame* child = m_frame->tree().scopedChild(index); |
1865 if (child) | 1871 if (child) |
1866 return child->domWindow(); | 1872 return child->domWindow(); |
1867 | 1873 |
1868 return 0; | 1874 return 0; |
1869 } | 1875 } |
1870 | 1876 |
1871 DOMWindowLifecycleNotifier& LocalDOMWindow::lifecycleNotifier() | 1877 DOMWindowLifecycleNotifier& LocalDOMWindow::lifecycleNotifier() |
1872 { | 1878 { |
1873 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<LocalDOMWin dow>::lifecycleNotifier()); | 1879 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<LocalDOMWin dow>::lifecycleNotifier()); |
1874 } | 1880 } |
(...skipping 23 matching lines...) Expand all Loading... | |
1898 visitor->trace(m_sessionStorage); | 1904 visitor->trace(m_sessionStorage); |
1899 visitor->trace(m_localStorage); | 1905 visitor->trace(m_localStorage); |
1900 visitor->trace(m_applicationCache); | 1906 visitor->trace(m_applicationCache); |
1901 visitor->trace(m_performance); | 1907 visitor->trace(m_performance); |
1902 visitor->trace(m_css); | 1908 visitor->trace(m_css); |
1903 visitor->trace(m_eventQueue); | 1909 visitor->trace(m_eventQueue); |
1904 #endif | 1910 #endif |
1905 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor); | 1911 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor); |
1906 EventTargetWithInlineData::trace(visitor); | 1912 EventTargetWithInlineData::trace(visitor); |
1907 LifecycleContext<LocalDOMWindow>::trace(visitor); | 1913 LifecycleContext<LocalDOMWindow>::trace(visitor); |
1914 FrameDestructionObserver::trace(visitor); | |
1908 } | 1915 } |
1909 | 1916 |
1910 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) | 1917 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) |
1911 { | 1918 { |
1912 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. | 1919 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. |
1913 return v8::Handle<v8::Object>(); | 1920 return v8::Handle<v8::Object>(); |
1914 } | 1921 } |
1915 | 1922 |
1916 } // namespace blink | 1923 } // namespace blink |
OLD | NEW |