Changeset 65340 in webkit
- Timestamp:
- Aug 13, 2010 4:35:34 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 4 deleted
- 65 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r65338 r65340 1 2010-08-13 Mihai Parparita <mihaip@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Session history should skip over JS redirects 6 https://bugs.webkit.org/show_bug.cgi?id=42861 7 8 Lock the back/forward list for location changes and form submits that 9 happen before the onload event fires that are not the result of user 10 gestures. 11 12 http/tests/history tests now pass, their expectations were updated 13 accordingly. Other tests needed a setTimeout wrapper around location 14 changes and form submits during onload, otherwise they would not 15 generate history entries as expected anymore. 16 17 * fast/css/target-fragment-match.html: 18 * fast/dom/location-hash.html: 19 * fast/dom/Geolocation/resources/cached-page-1.html: 20 * fast/dom/Window/timer-resume-on-navigation-back.html: 21 * fast/events/pageshow-pagehide-on-back-cached-with-frames-expected.txt: 22 * fast/events/pageshow-pagehide-on-back-cached-with-frames.html: 23 * fast/forms/button-state-restore.html: 24 * fast/forms/state-restore-to-non-autocomplete-form.html: 25 * fast/forms/state-restore-to-non-edited-controls.html: 26 * fast/frames/resources/cached-page-1.html: 27 * fast/frames/resources/cached-page-2.html: 28 * fast/harness/resources/cached-page-1.html: 29 * fast/harness/resources/cached-page-with-data-urls.html: 30 * fast/history/gesture-before-onload-expected.txt: Added. 31 * fast/history/gesture-before-onload.html: Added. 32 * fast/history/history-length.html: 33 * fast/history/resources/gesture-before-onload-target.html: Added. 34 * fast/history/saves-state-after-fragment-nav.html: 35 * fast/loader/input-element-page-cache-crash.html: 36 * fast/loader/stateobjects/document-destroyed-navigate-back.html: 37 * fast/loader/stateobjects/pushstate-clears-forward-history.html: 38 * fast/loader/subframe-navigate-during-main-frame-load.html: 39 * http/tests/history/back-to-post.php: 40 * http/tests/history/redirect-js-document-location-before-load-expected.txt: 41 * http/tests/history/redirect-js-form-submit-before-load-expected.txt: 42 * http/tests/history/redirect-js-location-assign-before-load-expected.txt: 43 * http/tests/history/redirect-js-location-before-load-expected.txt: 44 * http/tests/history/redirect-js-location-href-before-load-expected.txt: 45 * http/tests/loading/307-after-303-after-post-expected.txt: 46 * http/tests/loading/redirect-methods-expected.txt: 47 * http/tests/navigation/resources/back-send-referrer-helper.php: 48 * http/tests/navigation/resources/document-location.js: 49 (start): 50 * http/tests/navigation/resources/submit-to-fragment.pl: 51 * security/autocomplete-cleared-on-back.html: 52 * storage/hash-change-with-xhr.js: 53 (updateDatabase): 54 (invokeBack): 55 (runTest): 56 (runTestsInner): 57 58 1 59 2010-08-13 Sam Weinig <sam@webkit.org> 2 60 -
trunk/LayoutTests/fast/css/target-fragment-match.html
r64411 r65340 12 12 if (window.layoutTestController) 13 13 layoutTestController.waitUntilDone(); 14 15 // Location changes need to happen outside the onload handler to generate history entries. 16 setTimeout(runTest, 0); 17 } 18 19 function runTest() { 14 20 window.location.hash ='#target-01'; 15 21 document.body.offsetTop; -
trunk/LayoutTests/fast/dom/Geolocation/resources/cached-page-1.html
r65325 r65340 4 4 if (window.opener.reportPageOneOnload() == 1) { 5 5 window.opener.debug('resources/cached-page-1.html about to navigate to resources/cached-page-2.html') 6 location.href = 'cached-page-2.html'; 6 // Location changes need to happen outside the onload handler to generate history entries. 7 setTimeout(function() {location.href = 'cached-page-2.html';}, 0); 7 8 } 8 9 } -
trunk/LayoutTests/fast/dom/Window/timer-resume-on-navigation-back.html
r64411 r65340 19 19 layoutTestController.overridePreference("WebKitUsesPageCachePreferenceKey", 1); 20 20 } 21 window.setTimeout("verify()", timeoutValue); 22 timestamp = new Date().getTime(); 23 window.location.href = "data:text/html,<body onload='history.back()'></body>"; 21 // Location changes need to happen outside the onload handler to generate history entries. 22 setTimeout(function() { 23 window.setTimeout(verify, timeoutValue); 24 timestamp = new Date().getTime(); 25 window.location.href = "data:text/html,<body onload='history.back()'></body>"; 26 }, 0); 24 27 } 25 28 -
trunk/LayoutTests/fast/dom/location-hash.html
r64411 r65340 88 88 originalLocation = window.location.href; 89 89 originalHistoryLength = window.history.length; 90 91 step(); 90 91 // Location changes need to happen outside the onload handler to generate history entries. 92 setTimeout(step, 0); 92 93 } 93 94 </script> -
trunk/LayoutTests/fast/events/pageshow-pagehide-on-back-cached-with-frames-expected.txt
r64411 r65340 1 CONSOLE MESSAGE: line 20: ***Top level frame being parsed for the initial page load*** 2 CONSOLE MESSAGE: line 20: Subsubframe window.onload 3 CONSOLE MESSAGE: line 20: Subsubframe window.onpageshow, target = [object HTMLDocument], persisted = false 4 CONSOLE MESSAGE: line 20: Subframe window.onload 5 CONSOLE MESSAGE: line 20: Subframe window.onpageshow, target = [object HTMLDocument], persisted = false 6 CONSOLE MESSAGE: line 20: Main frame window.onload 7 CONSOLE MESSAGE: line 20: Main frame window.onpageshow, target = [object HTMLDocument], persisted = false 8 CONSOLE MESSAGE: line 20: ***Navigating top-level frame to a page that will immediately navigate back to this one*** 9 CONSOLE MESSAGE: line 20: Main frame window.onpagehide, target = [object HTMLDocument], persisted = true 10 CONSOLE MESSAGE: line 20: Subframe window.onpagehide, target = [object HTMLDocument], persisted = true 11 CONSOLE MESSAGE: line 20: Subsubframe window.onpagehide, target = [object HTMLDocument], persisted = true 12 CONSOLE MESSAGE: line 20: Subsubframe window.onpageshow, target = [object HTMLDocument], persisted = true 13 CONSOLE MESSAGE: line 20: Subframe window.onpageshow, target = [object HTMLDocument], persisted = true 14 CONSOLE MESSAGE: line 20: Main frame window.onpageshow, target = [object HTMLDocument], persisted = true 1 15 Test pageshow/pagehide event behavior when navigating away from a page with frames, putting the page in the page cache, then back to it. 2 ***Top level frame being parsed for the initial page load***3 Subsubframe window.onload4 Subsubframe window.onpageshow, target = [object HTMLDocument], persisted = false5 Subframe window.onload6 Subframe window.onpageshow, target = [object HTMLDocument], persisted = false7 Main frame window.onload8 Main frame window.onpageshow, target = [object HTMLDocument], persisted = false9 ***Navigating top-level frame to a page that will immediately navigate back to this one***10 Main frame window.onpagehide, target = [object HTMLDocument], persisted = true11 Subframe window.onpagehide, target = [object HTMLDocument], persisted = true12 Subsubframe window.onpagehide, target = [object HTMLDocument], persisted = true13 Subsubframe window.onpageshow, target = [object HTMLDocument], persisted = true14 Subframe window.onpageshow, target = [object HTMLDocument], persisted = true15 Main frame window.onpageshow, target = [object HTMLDocument], persisted = true16 16 -
trunk/LayoutTests/fast/events/pageshow-pagehide-on-back-cached-with-frames.html
r64411 r65340 15 15 function log(message) 16 16 { 17 var log = document.getElementById("log"); 18 log.innerHTML += message + "\n"; 17 // Logging to the console instead of the "log" DIV in the DOM because 18 // otherwise we trigger the assert mentioned at http://webkit.org/b/43152 19 // (since we log during pagehide) 20 console.log(message); 19 21 } 20 22 … … 32 34 } else { 33 35 log("***Navigating top-level frame to a page that will immediately navigate back to this one***"); 34 window.location.href = "data:text/html,<script>history.back();</scr" + "ipt>"; 36 // Location changes need to happen outside the onload handler to generate history entries. 37 setTimeout(function() {window.location.href = "data:text/html,<script>history.back();</scr" + "ipt>";}, 0); 35 38 } 36 39 } -
trunk/LayoutTests/fast/forms/button-state-restore.html
r57013 r65340 32 32 33 33 var form = document.getElementById("form"); 34 form.submit(); 34 35 // Submit form in a timeout to make sure that we create a new back/forward list item. 36 setTimeout(function() {form.submit();}, 0); 35 37 } 36 38 </script> -
trunk/LayoutTests/fast/forms/state-restore-to-non-autocomplete-form.html
r57012 r65340 39 39 document.getElementById('textarea2').value = 'good'; 40 40 document.getElementById('select2').value = 'BSD'; 41 document.getElementById('form2').submit(); 41 // Submit form in a timeout to make sure that we create a new back/forward list item. 42 setTimeout(function() {document.getElementById('form2').submit();}, 0); 42 43 } else { 43 44 // Second visit. -
trunk/LayoutTests/fast/forms/state-restore-to-non-edited-controls.html
r57013 r65340 38 38 39 39 document.getElementById('text1').value = 'edit'; 40 document.getElementById('form1').submit(); 40 // Submit form in a timeout to make sure that we create a new back/forward list item. 41 setTimeout(function() {document.getElementById('form1').submit();}, 0); 41 42 } else { 42 43 // Second visit. -
trunk/LayoutTests/fast/frames/resources/cached-page-1.html
r64411 r65340 18 18 19 19 window.opener.log("page-1, about to navigate to page-2.") 20 location.href = "cached-page-2.html"; 20 // Location changes need to happen outside the onload handler to generate history entries. 21 setTimeout(function() {location.href = "cached-page-2.html";}, 0); 21 22 } 22 23 -
trunk/LayoutTests/fast/frames/resources/cached-page-2.html
r64411 r65340 20 20 21 21 window.opener.log("page-2, about to navigate to page-3.") 22 location.href = "cached-page-3.html"; 22 // Location changes need to happen outside the onload handler to generate history entries. 23 setTimeout(function() {location.href = "cached-page-3.html";}, 0); 23 24 } 24 25 </script> -
trunk/LayoutTests/fast/harness/resources/cached-page-1.html
r64411 r65340 23 23 24 24 window.opener.log("page-1, about to navigate to page-2.") 25 location.href = "cached-page-2.html"; 25 // Location changes need to happen outside the onload handler to generate history entries. 26 setTimeout(function() {location.href = "cached-page-2.html";}, 0); 26 27 } 27 28 </script> -
trunk/LayoutTests/fast/harness/resources/cached-page-with-data-urls.html
r64411 r65340 19 19 20 20 window.opener.log("page with data urls, about to navigate to page-2.") 21 location.href = "cached-page-2.html"; 21 // Location changes need to happen outside the onload handler to generate history entries. 22 setTimeout(function() {location.href = "cached-page-2.html";}, 0); 22 23 } 23 24 </script> -
trunk/LayoutTests/fast/history/history-length.html
r64411 r65340 9 9 } 10 10 } 11 // This test advances history by 2 pages, then navigates back one, and 12 // records history.length. We expect history.length to indicate the total 13 // length of session history. At the end of the test, it should be 2 greater 14 // than it was at the start of the test. 15 switch (sessionStorage.testStage++) { 16 case 0: 17 sessionStorage.initialLength = history.length; 18 location = "?a"; 19 break; 20 case 1: 21 location = "?b"; 22 break; 23 case 2: 24 history.back(); 25 break; 26 case 3: 27 if (history.length == (sessionStorage.initialLength - 0) + 2) 28 document.body.innerHTML = "PASS"; 29 else 30 document.body.innerHTML = "FAIL: initialLength=" + sessionStorage.initialLength + ", history.length=" + history.length; 31 if (window.layoutTestController) 32 layoutTestController.notifyDone(); 33 break; 34 } 11 12 // Location changes need to happen outside the onload handler to generate history entries. 13 setTimeout(function() { 14 // This test advances history by 2 pages, then navigates back one, and 15 // records history.length. We expect history.length to indicate the total 16 // length of session history. At the end of the test, it should be 2 greater 17 // than it was at the start of the test. 18 switch (sessionStorage.testStage++) { 19 case 0: 20 sessionStorage.initialLength = history.length; 21 location = "?a"; 22 break; 23 case 1: 24 location = "?b"; 25 break; 26 case 2: 27 history.back(); 28 break; 29 case 3: 30 if (history.length == (sessionStorage.initialLength - 0) + 2) 31 document.body.innerHTML = "PASS"; 32 else 33 document.body.innerHTML = "FAIL: initialLength=" + sessionStorage.initialLength + ", history.length=" + history.length; 34 if (window.layoutTestController) 35 layoutTestController.notifyDone(); 36 break; 37 } 38 }, 0); 35 39 } 36 40 onunload = function() { -
trunk/LayoutTests/fast/history/resources/gesture-before-onload-target.html
r65339 r65340 15 15 { 16 16 var expected = parseInt(location.hash.slice(1)); 17 var actual = layoutTestController.webHistoryItemCount + 1; // Add one to include the referring page, which loaded before we started recording history.17 var actual = history.length; 18 18 if (actual === expected) 19 19 log("PASS: History item count should be " + expected + " and is."); … … 28 28 layoutTestController.dumpBackForwardList(); 29 29 layoutTestController.notifyDone(); 30 } else { 31 testHistoryItemCount(); 30 32 } 31 33 }, false); -
trunk/LayoutTests/fast/history/saves-state-after-fragment-nav.html
r64411 r65340 31 31 layoutTestController.waitUntilDone(); 32 32 } 33 navigateToHash(field); 34 navigateAwayAndBack(); 33 // Location changes need to happen outside the onload handler to generate history entries. 34 setTimeout(function() { 35 navigateToHash(field); 36 navigateAwayAndBack(); 37 }, 0); 35 38 } else { 36 39 document.body.innerHTML = (field.value == '') ? 'FAIL' : 'PASS'; -
trunk/LayoutTests/fast/loader/input-element-page-cache-crash.html
r64411 r65340 14 14 input.setAttribute("autocomplete", "on"); 15 15 input.parentNode.removeChild(input); 16 17 window.location = "data:text/html,<script>history.back();</scrip" + "t>"; 16 17 // Location changes need to happen outside the onload handler to generate history entries. 18 setTimeout(function() {window.location = "data:text/html,<script>history.back();</scrip" + "t>";}, 0); 18 19 } 19 20 -
trunk/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html
r64411 r65340 34 34 function loaded() 35 35 { 36 if (!sessionStorage.stage) 37 runFirstStageOfTest(); 38 else if (sessionStorage.stage == 2) 36 if (!sessionStorage.stage) { 37 // Location changes need to happen outside the onload handler to generate history entries. 38 setTimeout(runFirstStageOfTest, 0); 39 } else if (sessionStorage.stage == 2) 39 40 runSecondStageOfTest(); 40 41 else if (sessionStorage.stage == 3) -
trunk/LayoutTests/fast/loader/stateobjects/pushstate-clears-forward-history.html
r64411 r65340 9 9 } 10 10 } 11 switch (sessionStorage.testStage++) { 12 case 0: 13 location = "?a"; 14 break; 15 case 1: 16 location = "?b"; 17 break; 18 case 2: 19 history.back(); 20 break; 21 case 3: 22 history.pushState(null, null); 23 if (window.layoutTestController) 24 layoutTestController.notifyDone(); 25 break; 26 } 11 12 // Location changes need to happen outside the onload handler to generate history entries. 13 setTimeout(function() { 14 switch (sessionStorage.testStage++) { 15 case 0: 16 location = "?a"; 17 break; 18 case 1: 19 location = "?b"; 20 break; 21 case 2: 22 history.back(); 23 break; 24 case 3: 25 history.pushState(null, null); 26 if (window.layoutTestController) 27 layoutTestController.notifyDone(); 28 break; 29 } 30 }, 0); 27 31 } 28 32 onunload = function() { -
trunk/LayoutTests/fast/loader/subframe-navigate-during-main-frame-load.html
r64411 r65340 10 10 layoutTestController.waitUntilDone(); 11 11 } 12 13 location='resources/subframe-navigate-during-main-frame-load2.html'; 12 13 // Location changes need to happen outside the onload handler to generate history entries. 14 setTimeout(function() {location='resources/subframe-navigate-during-main-frame-load2.html';}, 0); 14 15 } 15 16 -
trunk/LayoutTests/http/tests/history/back-to-post.php
r47335 r65340 15 15 </form> 16 16 <script> 17 18 function submitForm() 19 { 20 // Submit form in a timeout to make sure that we create a new back/forward list item. 21 setTimeout(function() {document.forms[0].submit()}, 0); 22 } 23 17 24 if (window.layoutTestController) { 18 25 layoutTestController.dumpAsText(); … … 26 33 if (document.location.search == "") { 27 34 window.name = ""; // Use window.name to communicate between steps. 28 document.forms[0].submit();35 submitForm(); 29 36 } else if (document.location.search == "?1") { 30 37 if (window.name == "finish") { … … 35 42 } else { 36 43 document.forms[0].action = "?2"; 37 document.forms[0].submit();44 submitForm(); 38 45 } 39 46 } else { -
trunk/LayoutTests/http/tests/history/redirect-200-refresh-0-seconds.pl
r40424 r65340 13 13 <script> 14 14 if (window.layoutTestController) { 15 layoutTestController. keepWebHistory();15 layoutTestController.clearBackForwardList(); 16 16 layoutTestController.waitUntilDone(); 17 17 } -
trunk/LayoutTests/http/tests/history/redirect-200-refresh-2-seconds.pl
r40424 r65340 13 13 <script> 14 14 if (window.layoutTestController) { 15 layoutTestController. keepWebHistory();15 layoutTestController.clearBackForwardList(); 16 16 layoutTestController.waitUntilDone(); 17 17 } -
trunk/LayoutTests/http/tests/history/redirect-301-expected.txt
r40424 r65340 1 1 This page is the target of a redirect. 2 2 3 PASS: History item count should be 1and is.3 PASS: History item count should be 2 and is. 4 4 5 5 6 6 ============== Back Forward List ============== 7 curr-> http://127.0.0.1:8000/history/resources/redirect-target.html#1 **nav target** 7 http://127.0.0.1:8000/history/redirect-301.html **nav target** 8 curr-> http://127.0.0.1:8000/history/resources/redirect-target.html#2 **nav target** 8 9 =============================================== -
trunk/LayoutTests/http/tests/history/redirect-302-expected.txt
r40424 r65340 1 1 This page is the target of a redirect. 2 2 3 PASS: History item count should be 1and is.3 PASS: History item count should be 2 and is. 4 4 5 5 6 6 ============== Back Forward List ============== 7 curr-> http://127.0.0.1:8000/history/resources/redirect-target.html#1 **nav target** 7 http://127.0.0.1:8000/history/redirect-302.html **nav target** 8 curr-> http://127.0.0.1:8000/history/resources/redirect-target.html#2 **nav target** 8 9 =============================================== -
trunk/LayoutTests/http/tests/history/redirect-303-expected.txt
r40424 r65340 1 1 This page is the target of a redirect. 2 2 3 PASS: History item count should be 1and is.3 PASS: History item count should be 2 and is. 4 4 5 5 6 6 ============== Back Forward List ============== 7 curr-> http://127.0.0.1:8000/history/resources/redirect-target.html#1 **nav target** 7 http://127.0.0.1:8000/history/redirect-303.html **nav target** 8 curr-> http://127.0.0.1:8000/history/resources/redirect-target.html#2 **nav target** 8 9 =============================================== -
trunk/LayoutTests/http/tests/history/redirect-307-expected.txt
r40424 r65340 1 1 This page is the target of a redirect. 2 2 3 PASS: History item count should be 1and is.3 PASS: History item count should be 2 and is. 4 4 5 5 6 6 ============== Back Forward List ============== 7 curr-> http://127.0.0.1:8000/history/resources/redirect-target.html#1 **nav target** 7 http://127.0.0.1:8000/history/redirect-307.html **nav target** 8 curr-> http://127.0.0.1:8000/history/resources/redirect-target.html#2 **nav target** 8 9 =============================================== -
trunk/LayoutTests/http/tests/history/redirect-js-document-location-0-seconds.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-js-document-location-2-seconds.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-js-document-location-before-load-expected.txt
r64411 r65340 1 1 This page is the target of a redirect. 2 2 3 FAIL: History item count should be 1 but instead is 2.3 PASS: History item count should be 1 and is. 4 4 5 5 6 6 ============== Back Forward List ============== 7 http://127.0.0.1:8000/history/redirect-js-document-location-before-load.html **nav target**8 7 curr-> http://127.0.0.1:8000/history/resources/redirect-target.html#1 **nav target** 9 8 =============================================== -
trunk/LayoutTests/http/tests/history/redirect-js-document-location-before-load.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-js-form-submit-0-seconds.html
r53356 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-js-form-submit-2-seconds.html
r53356 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-js-form-submit-before-load-expected.txt
r40424 r65340 1 1 This page is the target of a redirect. 2 2 3 FAIL: History item count should be 1 but instead is 2.3 PASS: History item count should be 1 and is. 4 4 5 5 6 6 ============== Back Forward List ============== 7 http://127.0.0.1:8000/history/redirect-js-form-submit-before-load.html **nav target**8 7 curr-> http://127.0.0.1:8000/history/resources/redirect-target.html?#1 **nav target** 9 8 =============================================== -
trunk/LayoutTests/http/tests/history/redirect-js-form-submit-before-load.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-js-location-0-seconds.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-js-location-2-seconds.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-js-location-assign-0-seconds.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-js-location-assign-2-seconds.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-js-location-assign-before-load-expected.txt
r64411 r65340 1 1 This page is the target of a redirect. 2 2 3 FAIL: History item count should be 1 but instead is 2.3 PASS: History item count should be 1 and is. 4 4 5 5 6 6 ============== Back Forward List ============== 7 http://127.0.0.1:8000/history/redirect-js-location-assign-before-load.html **nav target**8 7 curr-> http://127.0.0.1:8000/history/resources/redirect-target.html#1 **nav target** 9 8 =============================================== -
trunk/LayoutTests/http/tests/history/redirect-js-location-assign-before-load.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-js-location-before-load-expected.txt
r64411 r65340 1 1 This page is the target of a redirect. 2 2 3 FAIL: History item count should be 1 but instead is 2.3 PASS: History item count should be 1 and is. 4 4 5 5 6 6 ============== Back Forward List ============== 7 http://127.0.0.1:8000/history/redirect-js-location-before-load.html **nav target**8 7 curr-> http://127.0.0.1:8000/history/resources/redirect-target.html#1 **nav target** 9 8 =============================================== -
trunk/LayoutTests/http/tests/history/redirect-js-location-before-load.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-js-location-href-0-seconds.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-js-location-href-2-seconds.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-js-location-href-before-load-expected.txt
r64411 r65340 1 1 This page is the target of a redirect. 2 2 3 FAIL: History item count should be 1 but instead is 2.3 PASS: History item count should be 1 and is. 4 4 5 5 6 6 ============== Back Forward List ============== 7 http://127.0.0.1:8000/history/redirect-js-location-href-before-load.html **nav target**8 7 curr-> http://127.0.0.1:8000/history/resources/redirect-target.html#1 **nav target** 9 8 =============================================== -
trunk/LayoutTests/http/tests/history/redirect-js-location-href-before-load.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-js-location-replace-0-seconds.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-js-location-replace-2-seconds.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-js-location-replace-before-load.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-meta-refresh-0-seconds.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/redirect-meta-refresh-2-seconds.html
r40424 r65340 5 5 <script> 6 6 if (window.layoutTestController) { 7 layoutTestController. keepWebHistory();7 layoutTestController.clearBackForwardList(); 8 8 layoutTestController.waitUntilDone(); 9 9 } -
trunk/LayoutTests/http/tests/history/resources/redirect-target.html
r40424 r65340 15 15 { 16 16 var expected = parseInt(location.hash.slice(1)); 17 var actual = layoutTestController.webHistoryItemCount + 1; // Add one to include the referring page, which loaded before we started recording history.17 var actual = history.length; 18 18 if (actual === expected) 19 19 log("PASS: History item count should be " + expected + " and is."); -
trunk/LayoutTests/http/tests/loading/307-after-303-after-post-expected.txt
r55157 r65340 2 2 main frame - didCommitLoadForFrame 3 3 main frame - didFinishDocumentLoadForFrame 4 main frame - willPerformClientRedirectToURL: http://127.0.0.1:8000/loading/resources/post-to-303-target.php 4 5 main frame - didHandleOnloadEventsForFrame 5 6 main frame - didFinishLoadForFrame … … 12 13 main frame - didReceiveServerRedirectForProvisionalLoadForFrame 13 14 http://127.0.0.1:8000/loading/resources/post-to-303-target.php - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/307-post-output-target.php, http status code 200> 15 main frame - didCancelClientRedirectForFrame 14 16 main frame - didCommitLoadForFrame 15 17 main frame - didFinishDocumentLoadForFrame -
trunk/LayoutTests/http/tests/loading/redirect-methods-expected.txt
r48953 r65340 20 20 frame "0" - didCommitLoadForFrame 21 21 frame "0" - didFinishDocumentLoadForFrame 22 frame "0" - willPerformClientRedirectToURL: http://127.0.0.1:8000/loading/resources/redirect-methods-result.php 22 23 frame "0" - didHandleOnloadEventsForFrame 23 24 frame "0" - didFinishLoadForFrame … … 28 29 frame "0" - didReceiveServerRedirectForProvisionalLoadForFrame 29 30 http://127.0.0.1:8000/loading/resources/redirect-methods-result.php - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true, http status code 200> 31 frame "0" - didCancelClientRedirectForFrame 30 32 frame "0" - didCommitLoadForFrame 31 33 frame "0" - didFinishDocumentLoadForFrame … … 48 50 frame "1" - didCommitLoadForFrame 49 51 frame "1" - didFinishDocumentLoadForFrame 52 frame "1" - willPerformClientRedirectToURL: http://127.0.0.1:8000/loading/resources/redirect-methods-result.php 50 53 frame "1" - didHandleOnloadEventsForFrame 51 54 frame "1" - didFinishLoadForFrame … … 56 59 frame "1" - didReceiveServerRedirectForProvisionalLoadForFrame 57 60 http://127.0.0.1:8000/loading/resources/redirect-methods-result.php - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true, http status code 200> 61 frame "1" - didCancelClientRedirectForFrame 58 62 frame "1" - didCommitLoadForFrame 59 63 frame "1" - didFinishDocumentLoadForFrame … … 76 80 frame "2" - didCommitLoadForFrame 77 81 frame "2" - didFinishDocumentLoadForFrame 82 frame "2" - willPerformClientRedirectToURL: http://127.0.0.1:8000/loading/resources/redirect-methods-result.php 78 83 frame "2" - didHandleOnloadEventsForFrame 79 84 frame "2" - didFinishLoadForFrame … … 84 89 frame "2" - didReceiveServerRedirectForProvisionalLoadForFrame 85 90 http://127.0.0.1:8000/loading/resources/redirect-methods-result.php - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true, http status code 200> 91 frame "2" - didCancelClientRedirectForFrame 86 92 frame "2" - didCommitLoadForFrame 87 93 frame "2" - didFinishDocumentLoadForFrame … … 104 110 frame "3" - didCommitLoadForFrame 105 111 frame "3" - didFinishDocumentLoadForFrame 112 frame "3" - willPerformClientRedirectToURL: http://127.0.0.1:8000/loading/resources/redirect-methods-result.php 106 113 frame "3" - didHandleOnloadEventsForFrame 107 114 frame "3" - didFinishLoadForFrame … … 112 119 frame "3" - didReceiveServerRedirectForProvisionalLoadForFrame 113 120 http://127.0.0.1:8000/loading/resources/redirect-methods-result.php - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true, http status code 200> 121 frame "3" - didCancelClientRedirectForFrame 114 122 frame "3" - didCommitLoadForFrame 115 123 frame "3" - didFinishDocumentLoadForFrame -
trunk/LayoutTests/http/tests/navigation/resources/back-send-referrer-helper.php
r40132 r65340 19 19 <script> 20 20 if (window.name == 1) { 21 // Navigate once more to add a history entry.22 document.loopback.submit();21 // Navigate once more (in a timeout) to add a history entry. 22 setTimeout(function() {document.loopback.submit();}, 0); 23 23 } else if (window.name == 2) { 24 24 history.go(-1); -
trunk/LayoutTests/http/tests/navigation/resources/document-location.js
r64411 r65340 8 8 layoutTestController.waitUntilDone(); 9 9 10 runTest(); 10 // Location changes need to happen outside the onload handler to generate history entries. 11 setTimeout(runTest, 0); 11 12 } else { 12 13 // loaded the ?1 navigation -
trunk/LayoutTests/http/tests/navigation/resources/submit-to-fragment.pl
r61207 r65340 23 23 switch (sessionStorage.stage++) { 24 24 case 1: 25 document.forms[0].submit(); 25 // Submit form in a timeout to make sure that we create a new back/forward list item. 26 setTimeout(function() {document.forms[0].submit();}, 0); 26 27 break; 27 28 case 2: -
trunk/LayoutTests/security/autocomplete-cleared-on-back.html
r64411 r65340 20 20 document.getElementById("firstInput").value = "SuperSeekritValue"; 21 21 document.getElementById("secondInput").value = "SuperSeekritValue"; 22 window.location = "resources/autocomplete-cleared-on-back2.html"; 22 // Location changes need to happen outside the onload handler to generate history entries. 23 setTimeout(function() {window.location = "resources/autocomplete-cleared-on-back2.html";}, 0); 23 24 return; 24 25 } -
trunk/LayoutTests/storage/hash-change-with-xhr.js
r64411 r65340 82 82 function runTest() 83 83 { 84 // Location changes need to happen outside the onload handler to generate history entries. 85 setTimeout(runTestsInner, 0); 86 } 87 88 function runTestsInner() 89 { 84 90 backIterations = 10; 85 91 consecutiveFailures = 0; -
trunk/WebCore/ChangeLog
r65336 r65340 1 2010-08-13 Mihai Parparita <mihaip@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Session history should skip over JS redirects 6 https://bugs.webkit.org/show_bug.cgi?id=42861 7 8 Lock the back/forward list for location changes and form submits that 9 happen before the onload event fires that are not the result of user 10 gestures. 11 12 Made form submission (at the ScheduledFormSubmission level) more similar 13 to ScheduledURLNavigation by having it call clientRedirected too, fixing 14 a long-standing FIXME. 15 16 Test: fast/history/gesture-before-onload-location-href.html, 17 fast/history/gesture-before-onload-form-submit.html and updated 18 expectations for http/tests/history tests that used to fail. 19 20 * loader/FormSubmission.cpp: 21 (WebCore::FormSubmission::requestURL): 22 (WebCore::FormSubmission::populateFrameLoadRequest): 23 * loader/FormSubmission.h: 24 * loader/RedirectScheduler.cpp: 25 (WebCore::ScheduledFormSubmission::ScheduledFormSubmission): 26 (WebCore::ScheduledFormSubmission::fire): 27 (WebCore::ScheduledFormSubmission::didStartTimer): 28 (WebCore::ScheduledFormSubmission::didStopTimer): 29 (WebCore::RedirectScheduler::scheduleRedirect): 30 (WebCore::RedirectScheduler::mustLockBackForwardList): 31 (WebCore::RedirectScheduler::scheduleLocationChange): 32 (WebCore::RedirectScheduler::scheduleFormSubmission): 33 * loader/RedirectScheduler.h: 34 1 35 2010-08-13 Leandro Pereira <leandro@profusion.mobi> 2 36 -
trunk/WebCore/loader/FormSubmission.cpp
r63999 r65340 180 180 } 181 181 182 KURL FormSubmission::requestURL() const 183 { 184 if (m_method == FormSubmission::PostMethod) 185 return m_action; 186 187 KURL requestURL(m_action); 188 requestURL.setQuery(m_formData->flattenToString()); 189 return requestURL; 190 } 191 182 192 void FormSubmission::populateFrameLoadRequest(FrameLoadRequest& frameRequest) 183 193 { … … 188 198 frameRequest.resourceRequest().setHTTPReferrer(m_referrer); 189 199 190 if (m_method == FormSubmission::GetMethod) 191 m_action.setQuery(m_formData->flattenToString()); 192 else { 200 if (m_method == FormSubmission::PostMethod) { 193 201 frameRequest.resourceRequest().setHTTPMethod("POST"); 194 202 frameRequest.resourceRequest().setHTTPBody(m_formData); … … 201 209 } 202 210 203 frameRequest.resourceRequest().setURL( m_action);211 frameRequest.resourceRequest().setURL(requestURL()); 204 212 FrameLoader::addHTTPOriginIfNeeded(frameRequest.resourceRequest(), m_origin); 205 213 } -
trunk/WebCore/loader/FormSubmission.h
r63999 r65340 86 86 87 87 void populateFrameLoadRequest(FrameLoadRequest&); 88 89 KURL requestURL() const; 88 90 89 91 Method method() const { return m_method; } -
trunk/WebCore/loader/RedirectScheduler.cpp
r64411 r65340 176 176 : ScheduledNavigation(0, submission->lockHistory(), lockBackForwardList, duringLoad, true) 177 177 , m_submission(submission) 178 , m_ wasProcessingUserGesture(UserGestureIndicator::processingUserGesture())178 , m_haveToldClient(false) 179 179 { 180 180 ASSERT(m_submission->state()); … … 183 183 virtual void fire(Frame* frame) 184 184 { 185 UserGestureIndicator gestureIndicator(m_wasProcessingUserGesture ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);186 187 185 // The submitForm function will find a target frame before using the redirection timer. 188 186 // Now that the timer has fired, we need to repeat the security check which normally is done when … … 195 193 frame->loader()->loadFrameRequest(frameRequest, lockHistory(), lockBackForwardList(), m_submission->event(), m_submission->state(), SendReferrer); 196 194 } 197 198 // FIXME: Implement didStartTimer? It would make sense to report form 199 // submissions as client redirects too. But we didn't do that in the past 200 // when form submission used a separate delay mechanism, so doing it will 201 // be a behavior change. 195 196 virtual void didStartTimer(Frame* frame, Timer<RedirectScheduler>* timer) 197 { 198 if (m_haveToldClient) 199 return; 200 m_haveToldClient = true; 201 frame->loader()->clientRedirected(m_submission->requestURL(), delay(), currentTime() + timer->nextFireInterval(), lockBackForwardList()); 202 } 203 204 virtual void didStopTimer(Frame* frame, bool newLoadInProgress) 205 { 206 if (!m_haveToldClient) 207 return; 208 frame->loader()->clientRedirectCancelledOrFinished(newLoadInProgress); 209 } 202 210 203 211 private: 204 212 RefPtr<FormSubmission> m_submission; 205 bool m_ wasProcessingUserGesture;213 bool m_haveToldClient; 206 214 }; 207 215 … … 241 249 return; 242 250 243 // We want a new historyitem if the refresh timeout is > 1 second.251 // We want a new back/forward list item if the refresh timeout is > 1 second. 244 252 if (!m_redirect || delay <= m_redirect->delay()) 245 253 schedule(new ScheduledRedirect(delay, url, true, delay <= 1, false)); 246 254 } 247 255 248 bool RedirectScheduler::mustLockBackForwardList(Frame* targetFrame) 249 { 256 bool RedirectScheduler::mustLockBackForwardList(Frame* targetFrame, bool wasUserGesture) 257 { 258 // Non-user navigation before the page has loaded should not create a new back/forward item. 259 // See https://webkit.org/b/42861 for the original motivation for this. 260 if (!wasUserGesture && targetFrame->loader()->documentLoader() && targetFrame->loader()->documentLoader()->isLoadingInAPISense()) 261 return true; 262 250 263 // Navigation of a subframe during loading of an ancestor frame does not create a new back/forward item. 251 264 // The definition of "during load" is any time before all handlers for the load event have been run. 252 265 // See https://bugs.webkit.org/show_bug.cgi?id=14957 for the original motivation for this. 253 254 266 for (Frame* ancestor = targetFrame->tree()->parent(); ancestor; ancestor = ancestor->tree()->parent()) { 255 267 Document* document = ancestor->document(); … … 267 279 return; 268 280 269 lockBackForwardList = lockBackForwardList || mustLockBackForwardList(m_frame );281 lockBackForwardList = lockBackForwardList || mustLockBackForwardList(m_frame, wasUserGesture); 270 282 271 283 FrameLoader* loader = m_frame->loader(); … … 301 313 // See https://bugs.webkit.org/show_bug.cgi?id=32383 for the original motivation for this. 302 314 303 bool lockBackForwardList = mustLockBackForwardList(m_frame ) || (submission->state()->formSubmissionTrigger() == SubmittedByJavaScript && m_frame->tree()->parent());315 bool lockBackForwardList = mustLockBackForwardList(m_frame, UserGestureIndicator::processingUserGesture()) || (submission->state()->formSubmissionTrigger() == SubmittedByJavaScript && m_frame->tree()->parent()); 304 316 305 317 schedule(new ScheduledFormSubmission(submission, lockBackForwardList, duringLoad)); -
trunk/WebCore/loader/RedirectScheduler.h
r65021 r65340 71 71 void schedule(PassOwnPtr<ScheduledNavigation>); 72 72 73 static bool mustLockBackForwardList(Frame* targetFrame );73 static bool mustLockBackForwardList(Frame* targetFrame, bool mustLockIfDuringLoad); 74 74 75 75 Frame* m_frame; … … 80 80 } // namespace WebCore 81 81 82 #endif // FrameLoader_h82 #endif // RedirectScheduler_h
Note: See TracChangeset
for help on using the changeset viewer.