Changeset 214783 in webkit
- Timestamp:
- Apr 3, 2017 6:06:02 AM (7 years ago)
- Location:
- releases/WebKitGTK/webkit-2.16
- Files:
-
- 6 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog
r214778 r214783 1 2017-03-22 Chris Dumez <cdumez@apple.com> 2 3 WebKit should disallow beforeunload alerts from web pages users have never interacted with 4 https://bugs.webkit.org/show_bug.cgi?id=169936 5 <rdar://problem/23798897> 6 7 Reviewed by Brent Fulgham. 8 9 * fast/events/before-unload-return-string-conversion-expected.txt: 10 * fast/events/before-unload-returnValue-expected.txt: 11 Rebaseline now that the CONFIRM MESSAGE is no longer shown. This is because there is 12 no user interaction with the page. 13 14 * fast/events/beforeunload-alert-no-user-interaction-expected.txt: Added. 15 * fast/events/beforeunload-alert-no-user-interaction.html: Added. 16 * fast/events/beforeunload-alert-user-interaction-expected.txt: Added. 17 * fast/events/beforeunload-alert-user-interaction.html: Added. 18 * fast/events/beforeunload-alert-user-interaction2-expected.txt: Added. 19 * fast/events/beforeunload-alert-user-interaction2.html: Added. 20 Add layout test coverage. 21 22 * fast/loader/form-submission-after-beforeunload-cancel.html: 23 * fast/loader/show-only-one-beforeunload-dialog.html: 24 * http/tests/misc/iframe-beforeunload-dialog-matching-ancestor-securityorigin.html: 25 * http/tests/misc/iframe-beforeunload-dialog-not-matching-ancestor-securityorigin.html: 26 Simulate user interaction with the page so that the CONFIRM MESSAGE log lines are still 27 shown. 28 1 29 2017-03-21 Sergio Villar Senin <svillar@igalia.com> 2 30 -
releases/WebKitGTK/webkit-2.16/LayoutTests/fast/events/before-unload-return-string-conversion-expected.txt
r212625 r214783 1 CONFIRM NAVIGATION: PASS2 1 Tests that the value returned from a beforeunload event handler gets converted to a string, even if the returnValue property was already set. 3 2 -
releases/WebKitGTK/webkit-2.16/LayoutTests/fast/events/before-unload-returnValue-expected.txt
r155367 r214783 1 CONFIRM NAVIGATION: This is beforeunload from the top level frame.2 1 Tests the returnValue attribute of the BeforeUnloadEvent. 3 2 -
releases/WebKitGTK/webkit-2.16/LayoutTests/fast/loader/form-submission-after-beforeunload-cancel.html
r122687 r214783 1 <script src="../../resources/ui-helper.js"></script> 1 2 <script> 2 3 if (window.testRunner) { … … 7 8 8 9 _confirmationDialogDisplayedOnce = false; 10 11 function submitForm() 12 { 13 document.forms[0].submit(); 14 } 9 15 10 16 window.addEventListener("beforeunload", function() { … … 35 41 36 42 <div id="console"></div> 37 43 <input id="testButton" type="button" value="Click to submit form" onclick="submitForm()"> 38 44 <form action="resources/pass-and-notify-done.html" method="POST"> 39 45 </form> 40 46 41 47 <script> 42 document.forms[0].submit(); 48 // Simulate a user interaction with the page so that the beforeunload alert shows. 49 const testButton = document.getElementById("testButton"); 50 UIHelper.activateAt(testButton.offsetLeft + 5, testButton.offsetTop + 5); 43 51 </script> -
releases/WebKitGTK/webkit-2.16/LayoutTests/fast/loader/show-only-one-beforeunload-dialog.html
r152941 r214783 1 <script src="../../resources/ui-helper.js"></script> 1 2 <script> 2 3 … … 6 7 } 7 8 9 function navigateFrame() 10 { 11 window.location.href = 'resources/notify-done.html'; 12 } 13 8 14 window.onload = function() 9 15 { 10 window.setTimeout("window.location.href = 'resources/notify-done.html';", 0); 16 // Simulate a user interaction with the page so that the beforeunload alert shows. 17 const testButton = document.getElementById("testButton"); 18 UIHelper.activateAt(testButton.offsetLeft + 5, testButton.offsetTop + 5); 11 19 } 12 20 … … 21 29 This page also has a beforeunload dialog, itself.<br> 22 30 Only the dialog from this top-level frame should display, and none of the iframe ones should display.<br> 31 <input id="testButton" type="button" value="Click to navigate" onclick="navigateFrame()"><br> 23 32 <iframe src="resources/iframe-with-beforeunload.html"></iframe><br> 24 33 <iframe src="resources/iframe-with-beforeunload.html"></iframe><br> -
releases/WebKitGTK/webkit-2.16/LayoutTests/http/tests/misc/iframe-beforeunload-dialog-matching-ancestor-securityorigin.html
r152941 r214783 1 <script src="/js-test-resources/ui-helper.js"></script> 1 2 <script> 2 3 … … 6 7 } 7 8 9 function navigateFrame() 10 { 11 window.location.href = 'resources/notify-done.html'; 12 } 13 8 14 window.onload = function() 9 15 { 10 window.setTimeout("window.location.href = 'resources/notify-done.html';", 0); 16 // Simulate a user interaction with the page so that the beforeunload alert shows. 17 const testButton = document.getElementById("testButton"); 18 UIHelper.activateAt(testButton.offsetLeft + 5, testButton.offsetTop + 5); 11 19 } 12 20 … … 15 23 When viewed using the host 127.0.0.1, this page has an iframe whose security origin matches the main frame.<br> 16 24 The iframe has a beforeunload handler, and that handler should result in the display of the page dismissal dialog.<br> 25 <input id="testButton" type="button" value="Click to navigate" onclick="navigateFrame()"> 17 26 <iframe src="http://127.0.0.1:8000/misc/resources/iframe-with-beforeunload.html"></iframe><br> 18 27 </body> -
releases/WebKitGTK/webkit-2.16/LayoutTests/http/tests/misc/iframe-beforeunload-dialog-not-matching-ancestor-securityorigin.html
r152941 r214783 1 <script src="/js-test-resources/ui-helper.js"></script> 1 2 <script> 2 3 … … 6 7 } 7 8 9 function navigateFrame() 10 { 11 window.location.href = 'resources/notify-done.html'; 12 } 13 8 14 window.onload = function() 9 15 { 10 window.setTimeout("window.location.href = 'resources/notify-done.html';", 0); 16 // Simulate a user interaction with the page so that the beforeunload alert shows. 17 const testButton = document.getElementById("testButton"); 18 UIHelper.activateAt(testButton.offsetLeft + 5, testButton.offsetTop + 5); 11 19 } 12 20 … … 15 23 When viewed using the host 127.0.0.1, this page has an iframe whose security origin is different from the main frame.<br> 16 24 The iframe has a beforeunload handler, and that handler should not result in the display of the page dismissal dialog since the security origins differ.<br> 25 <input id="testButton" type="button" value="Click to navigate" onclick="navigateFrame()"><br> 17 26 <iframe src="http://localhost:8000/misc/resources/iframe-with-beforeunload.html"></iframe><br> 18 27 </body> -
releases/WebKitGTK/webkit-2.16/LayoutTests/imported/w3c/ChangeLog
r214779 r214783 1 2017-03-22 Chris Dumez <cdumez@apple.com> 2 3 WebKit should disallow beforeunload alerts from web pages users have never interacted with 4 https://bugs.webkit.org/show_bug.cgi?id=169936 5 <rdar://problem/23798897> 6 7 Reviewed by Brent Fulgham. 8 9 * web-platform-tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-canceling-expected.txt: 10 * web-platform-tests/html/webappapis/scripting/events/compile-event-handler-settings-objects-expected.txt: 11 Rebaseline now that the CONFIRM MESSAGE lines are now longer shown. This is because there is no user interaction 12 with the page. 13 1 14 2017-03-22 Youenn Fablet <youenn@apple.com> 2 15 -
releases/WebKitGTK/webkit-2.16/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-canceling-expected.txt
r212625 r214783 1 CONFIRM NAVIGATION:2 CONFIRM NAVIGATION: false3 CONFIRM NAVIGATION: true4 CONFIRM NAVIGATION: 05 CONFIRM NAVIGATION: foo6 CONFIRM NAVIGATION: foo7 CONFIRM NAVIGATION: foo8 CONFIRM NAVIGATION: foo9 CONFIRM NAVIGATION: foo10 CONFIRM NAVIGATION: foo11 1 12 2 PASS Returning a string must not cancel the event: CustomEvent, non-cancelable -
releases/WebKitGTK/webkit-2.16/LayoutTests/platform/ios-simulator/TestExpectations
r212617 r214783 357 357 editing/caret/emoji.html [ Skip ] 358 358 webkit.org/b/155233 fast/events/max-tabindex-focus.html [ Skip ] 359 fast/events/beforeunload-alert-user-interaction.html [ Skip ] 359 360 fast/forms/validation-bubble-escape-key-dismiss.html [ Skip ] 360 361 fast/forms/validation-message-maxLength.html [ Skip ] -
releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog
r214782 r214783 1 2017-03-22 Chris Dumez <cdumez@apple.com> 2 3 WebKit should disallow beforeunload alerts from web pages users have never interacted with 4 https://bugs.webkit.org/show_bug.cgi?id=169936 5 <rdar://problem/23798897> 6 7 Reviewed by Brent Fulgham. 8 9 WebKit should disallow beforeunload alerts from web pages users have never interacted with. 10 This reduces the risk of annoyance to the user and is allowed by the specification: 11 - https://html.spec.whatwg.org/multipage/browsers.html#prompt-to-unload-a-document (Step 8): 12 which says: 13 """ 14 The user agent is encouraged to avoid asking the user for confirmation if it judges that doing 15 so would be annoying, deceptive, or pointless. A simple heuristic might be that if the user 16 has not interacted with the document, the user agent would not ask for confirmation before 17 unloading it. 18 """ 19 20 Firefox already implements this, Chrome does not. 21 22 Tests: fast/events/beforeunload-alert-no-user-interaction.html 23 fast/events/beforeunload-alert-user-interaction.html 24 fast/events/beforeunload-alert-user-interaction2.html 25 26 * loader/FrameLoader.cpp: 27 (WebCore::shouldAskForNavigationConfirmation): 28 (WebCore::FrameLoader::dispatchBeforeUnloadEvent): 29 1 30 2017-03-22 Brent Fulgham <bfulgham@apple.com> 2 31 -
releases/WebKitGTK/webkit-2.16/Source/WebCore/loader/FrameLoader.cpp
r214771 r214783 2987 2987 } 2988 2988 2989 static bool shouldAskForNavigationConfirmation(const BeforeUnloadEvent& event) 2990 { 2989 static bool shouldAskForNavigationConfirmation(Document& document, const BeforeUnloadEvent& event) 2990 { 2991 bool userDidInteractWithPage = document.topDocument().lastHandledUserGestureTimestamp() > 0; 2991 2992 // Web pages can request we ask for confirmation before navigating by: 2992 2993 // - Cancelling the BeforeUnloadEvent (modern way) … … 2994 2995 // - Returning a non-empty string from the event handler, which is then set as returnValue 2995 2996 // attribute on the BeforeUnloadEvent. 2996 return event.defaultPrevented() || !event.returnValue().isEmpty();2997 return userDidInteractWithPage && (event.defaultPrevented() || !event.returnValue().isEmpty()); 2997 2998 } 2998 2999 … … 3021 3022 document->defaultEventHandler(beforeUnloadEvent.get()); 3022 3023 3023 if (!shouldAskForNavigationConfirmation( beforeUnloadEvent))3024 if (!shouldAskForNavigationConfirmation(*document, beforeUnloadEvent)) 3024 3025 return true; 3025 3026
Note: See TracChangeset
for help on using the changeset viewer.