Changeset 214771 in webkit
- Timestamp:
- Apr 3, 2017 5:01:58 AM (7 years ago)
- Location:
- releases/WebKitGTK/webkit-2.16
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog
r214768 r214771 1 2017-03-20 Daniel Bates <dabates@apple.com> 2 3 Prevent new navigations from onbeforeunload handler 4 https://bugs.webkit.org/show_bug.cgi?id=169891 5 <rdar://problem/31155736> 6 7 Reviewed by Ryosuke Niwa. 8 9 Update test to ensure that we disallow navigation initiated via a DOM click event from 10 an onbeforeunload handler. 11 12 * fast/events/before-unload-forbidden-navigation.html: 13 1 14 2017-03-19 Chris Dumez <cdumez@apple.com> 2 15 -
releases/WebKitGTK/webkit-2.16/LayoutTests/fast/events/before-unload-forbidden-navigation.html
r120792 r214771 13 13 14 14 var log = document.getElementById('log'); 15 var didFireBeforeUnloadEvent = false; 15 16 16 17 function test(iframe) { … … 26 27 } 27 28 29 function navigateByClickingHyperlink(contentWindow, url) { 30 var link = contentWindow.document.createElement('a'); 31 link.href = url; 32 link.click(); 33 } 34 28 35 function fired(contentWindow) { 36 if (didFireBeforeUnloadEvent) 37 return; 38 didFireBeforeUnloadEvent = true; 39 29 40 location.href = 'resources/before-unload-in-subframe-fail.html'; 30 41 contentWindow.location.href = 'resources/before-unload-in-subframe-fail.html'; 42 navigateByClickingHyperlink(contentWindow, 'resources/before-unload-in-subframe-fail.html'); 43 navigateByClickingHyperlink(window, 'resources/before-unload-in-subframe-fail.html'); 44 31 45 log.innerHTML = 'PASS 1/2'; 32 46 contentWindow.frameElement.halfPassed = true; -
releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog
r214770 r214771 1 2017-03-20 Daniel Bates <dabates@apple.com> 2 3 Prevent new navigations from onbeforeunload handler 4 https://bugs.webkit.org/show_bug.cgi?id=169891 5 <rdar://problem/31155736> 6 7 Reviewed by Ryosuke Niwa. 8 9 Ensure that all navigations initiated from an onbeforeunload handler are disallowed 10 regardless of how they were scheduled. Such navigations go against the expectation 11 of a user. 12 13 * loader/FrameLoader.cpp: 14 (WebCore::FrameLoader::isNavigationAllowed): Added. 15 (WebCore::FrameLoader::loadURL): Modified code to call FrameLoader::isNavigationAllowed(). 16 (WebCore::FrameLoader::loadWithDocumentLoader): Ditto. 17 (WebCore::FrameLoader::stopAllLoaders): Ditto. 18 * loader/FrameLoader.h: 19 1 20 2017-03-20 Simon Fraser <simon.fraser@apple.com> 2 21 -
releases/WebKitGTK/webkit-2.16/Source/WebCore/loader/FrameLoader.cpp
r214747 r214771 1186 1186 } 1187 1187 1188 bool FrameLoader::isNavigationAllowed() const 1189 { 1190 return m_pageDismissalEventBeingDispatched == PageDismissalType::None && NavigationDisablerForBeforeUnload::isNavigationAllowed(); 1191 } 1192 1188 1193 void FrameLoader::loadURL(const FrameLoadRequest& frameLoadRequest, const String& referrer, FrameLoadType newLoadType, Event* event, FormState* formState) 1189 1194 { … … 1224 1229 } 1225 1230 1226 if ( m_pageDismissalEventBeingDispatched != PageDismissalType::None)1231 if (!isNavigationAllowed()) 1227 1232 return; 1228 1233 … … 1426 1431 ASSERT(m_frame.view()); 1427 1432 1428 if ( m_pageDismissalEventBeingDispatched != PageDismissalType::None)1433 if (!isNavigationAllowed()) 1429 1434 return; 1430 1435 … … 1613 1618 { 1614 1619 ASSERT(!m_frame.document() || m_frame.document()->pageCacheState() != Document::InPageCache); 1615 if ( m_pageDismissalEventBeingDispatched != PageDismissalType::None)1620 if (!isNavigationAllowed()) 1616 1621 return; 1617 1622 -
releases/WebKitGTK/webkit-2.16/Source/WebCore/loader/FrameLoader.h
r214747 r214771 387 387 void applyShouldOpenExternalURLsPolicyToNewDocumentLoader(DocumentLoader&, ShouldOpenExternalURLsPolicy propagatedPolicy); 388 388 389 bool isNavigationAllowed() const; 390 389 391 Frame& m_frame; 390 392 FrameLoaderClient& m_client;
Note: See TracChangeset
for help on using the changeset viewer.