Changeset 214365 in webkit
- Timestamp:
- Mar 24, 2017 12:34:11 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r214364 r214365 1 2017-03-24 Daniel Bates <dabates@apple.com> 2 3 Prevent new navigations during document unload 4 https://bugs.webkit.org/show_bug.cgi?id=169934 5 <rdar://problem/31247584> 6 7 Reviewed by Chris Dumez. 8 9 Add a test to ensure that we do not cause an assertion fail when calling setTimeout 10 after starting a navigation from an onunload event handler. 11 12 * fast/frames/frame-unload-navigate-and-setTimeout-assert-fail-expected.txt: Added. 13 * fast/frames/frame-unload-navigate-and-setTimeout-assert-fail.html: Added. 14 1 15 2017-03-24 Myles C. Maxfield <mmaxfield@apple.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r214364 r214365 1 2017-03-24 Daniel Bates <dabates@apple.com> 2 3 Prevent new navigations during document unload 4 https://bugs.webkit.org/show_bug.cgi?id=169934 5 <rdar://problem/31247584> 6 7 Reviewed by Chris Dumez. 8 9 Similar to our policy of preventing new navigations from onbeforeunload handlers 10 we should prevent new navigations that are initiated during the document unload 11 process. 12 13 The significant part of this change is the instantiation of the RAII object NavigationDisabler 14 in Document::prepareForDestruction(). The rest of this change just renames class 15 NavigationDisablerForBeforeUnload to NavigationDisabler now that this RAII class is 16 used to prevent navigation from both onbeforeunload event handlers and when unloading 17 a document. 18 19 Test: fast/frames/frame-unload-navigate-and-setTimeout-assert-fail.html 20 21 * dom/Document.cpp: 22 (WebCore::Document::prepareForDestruction): Disable new navigations when disconnecting 23 subframes. Also assert that the document is not in the page cache before we fall off 24 the end of the function. 25 * loader/FrameLoader.cpp: 26 (WebCore::FrameLoader::isNavigationAllowed): Update for renaming below. 27 (WebCore::FrameLoader::shouldClose): Ditto. 28 * loader/NavigationScheduler.cpp: 29 (WebCore::NavigationScheduler::shouldScheduleNavigation): Ditto. 30 * loader/NavigationScheduler.h: 31 (WebCore::NavigationDisabler::NavigationDisabler): Renamed class; formerly named NavigationDisablerForBeforeUnload. 32 (WebCore::NavigationDisabler::~NavigationDisabler): Ditto. 33 (WebCore::NavigationDisabler::isNavigationAllowed): Ditto. 34 (WebCore::NavigationDisablerForBeforeUnload::NavigationDisablerForBeforeUnload): Deleted. 35 (WebCore::NavigationDisablerForBeforeUnload::~NavigationDisablerForBeforeUnload): Deleted. 36 (WebCore::NavigationDisablerForBeforeUnload::isNavigationAllowed): Deleted. 37 1 38 2017-03-24 Myles C. Maxfield <mmaxfield@apple.com> 2 39 -
trunk/Source/WebCore/dom/Document.cpp
r214361 r214365 2225 2225 } 2226 2226 #endif 2227 2228 disconnectDescendantFrames(); 2227 2228 { 2229 NavigationDisabler navigationDisabler; 2230 disconnectDescendantFrames(); 2231 } 2232 2229 2233 if (m_domWindow && m_frame) 2230 2234 m_domWindow->willDetachDocumentFromFrame(); … … 2282 2286 2283 2287 m_hasPreparedForDestruction = true; 2288 2289 // Note that m_pageCacheState can be Document::AboutToEnterPageCache if our frame 2290 // was removed in an onpagehide event handler fired when the top-level frame is 2291 // about to enter the page cache. 2292 ASSERT_WITH_SECURITY_IMPLICATION(m_pageCacheState != Document::InPageCache); 2284 2293 } 2285 2294 -
trunk/Source/WebCore/loader/FrameLoader.cpp
r214277 r214365 1213 1213 bool FrameLoader::isNavigationAllowed() const 1214 1214 { 1215 return m_pageDismissalEventBeingDispatched == PageDismissalType::None && NavigationDisabler ForBeforeUnload::isNavigationAllowed();1215 return m_pageDismissalEventBeingDispatched == PageDismissalType::None && NavigationDisabler::isNavigationAllowed(); 1216 1216 } 1217 1217 … … 2991 2991 bool shouldClose = false; 2992 2992 { 2993 NavigationDisabler ForBeforeUnloadnavigationDisabler;2993 NavigationDisabler navigationDisabler; 2994 2994 size_t i; 2995 2995 -
trunk/Source/WebCore/loader/NavigationScheduler.cpp
r212250 r214365 56 56 namespace WebCore { 57 57 58 unsigned NavigationDisabler ForBeforeUnload::s_navigationDisableCount = 0;58 unsigned NavigationDisabler::s_navigationDisableCount = 0; 59 59 60 60 class ScheduledNavigation { … … 365 365 if (protocolIsJavaScript(url)) 366 366 return true; 367 return NavigationDisabler ForBeforeUnload::isNavigationAllowed();367 return NavigationDisabler::isNavigationAllowed(); 368 368 } 369 369 -
trunk/Source/WebCore/loader/NavigationScheduler.h
r210859 r214365 44 44 class URL; 45 45 46 class NavigationDisabler ForBeforeUnload{46 class NavigationDisabler { 47 47 public: 48 NavigationDisabler ForBeforeUnload()48 NavigationDisabler() 49 49 { 50 50 s_navigationDisableCount++; 51 51 } 52 ~NavigationDisabler ForBeforeUnload()52 ~NavigationDisabler() 53 53 { 54 54 ASSERT(s_navigationDisableCount);
Note: See TracChangeset
for help on using the changeset viewer.