Changeset 205805 in webkit
- Timestamp:
- Sep 12, 2016 2:26:19 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r205791 r205805 1 2016-09-12 Chris Dumez <cdumez@apple.com> 2 3 Start using Document::pageCacheState() instead of Document::inPageCache() 4 https://bugs.webkit.org/show_bug.cgi?id=161851 5 6 Reviewed by Ryosuke Niwa. 7 8 Start using Document::pageCacheState() instead of Document::inPageCache() 9 as the latter one is confusing (given that it is true when firing the 10 pagehide event, when the document is about to enter page cache). 11 12 * loader/FrameLoader.cpp: 13 (WebCore::FrameLoader::closeURL): 14 (WebCore::FrameLoader::clear): 15 (WebCore::FrameLoader::dispatchUnloadEvents): 16 * loader/cache/CachedResource.cpp: 17 (WebCore::CachedResource::load): 18 * page/Page.cpp: 19 (WebCore::incrementFrame): Deleted. 20 * page/Page.h: 21 1 22 2016-09-11 Chris Dumez <cdumez@apple.com> 2 23 -
trunk/Source/WebCore/loader/FrameLoader.cpp
r205786 r205805 518 518 } else { 519 519 // Should only send the pagehide event here if the current document exists and has not been placed in the page cache. 520 unloadEventPolicy = currentDocument && !currentDocument->inPageCache()? UnloadEventPolicyUnloadAndPageHide : UnloadEventPolicyUnloadOnly;520 unloadEventPolicy = currentDocument && currentDocument->pageCacheState() == Document::NotInPageCache ? UnloadEventPolicyUnloadAndPageHide : UnloadEventPolicyUnloadOnly; 521 521 } 522 522 … … 591 591 m_needsClear = false; 592 592 593 if ( !m_frame.document()->inPageCache()) {593 if (m_frame.document()->pageCacheState() != Document::InPageCache) { 594 594 m_frame.document()->cancelParsing(); 595 595 m_frame.document()->stopActiveDOMObjects(); … … 604 604 InspectorInstrumentation::frameWindowDiscarded(&m_frame, m_frame.document()->domWindow()); 605 605 m_frame.document()->domWindow()->resetUnlessSuspendedForDocumentSuspension(); 606 m_frame.script().clearWindowShell(newDocument->domWindow(), m_frame.document()-> inPageCache());606 m_frame.script().clearWindowShell(newDocument->domWindow(), m_frame.document()->pageCacheState() == Document::AboutToEnterPageCache); 607 607 } 608 608 … … 2925 2925 if (unloadEventPolicy == UnloadEventPolicyUnloadAndPageHide) { 2926 2926 m_pageDismissalEventBeingDispatched = PageDismissalType::PageHide; 2927 m_frame.document()->domWindow()->dispatchEvent(PageTransitionEvent::create(eventNames().pagehideEvent, m_frame.document()-> inPageCache()), m_frame.document());2927 m_frame.document()->domWindow()->dispatchEvent(PageTransitionEvent::create(eventNames().pagehideEvent, m_frame.document()->pageCacheState() == Document::AboutToEnterPageCache), m_frame.document()); 2928 2928 } 2929 2929 … … 2931 2931 // https://bugs.webkit.org/show_bug.cgi?id=116770 2932 2932 2933 if ( !m_frame.document()->inPageCache()) {2933 if (m_frame.document()->pageCacheState() == Document::NotInPageCache) { 2934 2934 Ref<Event> unloadEvent(Event::create(eventNames().unloadEvent, false, false)); 2935 2935 // The DocumentLoader (and thus its LoadTiming) might get destroyed … … 2957 2957 return; 2958 2958 2959 if (m_frame.document()-> inPageCache())2959 if (m_frame.document()->pageCacheState() != Document::NotInPageCache) 2960 2960 return; 2961 2961 -
trunk/Source/WebCore/loader/cache/CachedResource.cpp
r205750 r205805 269 269 270 270 // Prevent new loads if we are in the PageCache or being added to the PageCache. 271 if (frame.page() && frame.page()->inPageCache()) { 272 failBeforeStarting(); 273 return; 271 // We query the top document because new frames may be created in pagehide event handlers 272 // and their pageCacheState will not reflect the fact that they are about to enter page 273 // cache. 274 if (auto* topDocument = frame.mainFrame().document()) { 275 if (topDocument->pageCacheState() != Document::NotInPageCache) { 276 failBeforeStarting(); 277 return; 278 } 274 279 } 275 280 -
trunk/Source/WebCore/page/Page.cpp
r204637 r205805 580 580 } 581 581 582 bool Page::inPageCache() const583 {584 auto* document = mainFrame().document();585 return document && document->inPageCache();586 }587 588 582 static Frame* incrementFrame(Frame* curr, bool forward, bool wrapFlag) 589 583 { -
trunk/Source/WebCore/page/Page.h
r204466 r205805 167 167 const MainFrame& mainFrame() const { return m_mainFrame.get(); } 168 168 169 bool inPageCache() const;170 171 169 bool openedByDOM() const; 172 170 void setOpenedByDOM();
Note: See TracChangeset
for help on using the changeset viewer.