Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(868)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/history/saves-state-after-fragment-nav.html

Issue 2741513002: [Merge M-57] Add a warning for the deprecation of content-initiated data URL navigations (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <script> 2 <script>
3 3
4 // Navigation steps: 4 // Navigation steps:
5 // 1- loads this page 5 // 1- loads this page
6 // 2- loads this page + hash (doesn't call onload) 6 // 2- loads this page + hash (doesn't call onload)
7 // 3- loads a data URL that just navigates back 7 // 3- loads a data URL that just navigates back
8 // 4- loads this page + hash (calls onload, triggering completion) 8 // 4- loads this page + hash (calls onload, triggering completion)
9 9
10 function navigateToHash(field) { 10 function navigateToHash(field) {
11 location.hash = 'hash'; 11 location.hash = 'hash';
12 field.value = 'test'; 12 field.value = 'test';
13 } 13 }
14 14
15 function navigateAwayAndBack() { 15 function navigateAwayAndBack() {
16 // Assigning to location does not create a history entry, so 16 // Assigning to location does not create a history entry, so
17 // instead we simulate a link click. 17 // instead we simulate a link click.
18 var evt = document.createEvent("MouseEvents"); 18 var evt = document.createEvent("MouseEvents");
19 evt.initMouseEvent("click", true, true, window, 19 evt.initMouseEvent("click", true, true, window,
20 0, 0, 0, 0, 0, false, false, false, false, 0, null); 20 0, 0, 0, 0, 0, false, false, false, false, 0, null);
21 document.getElementById('anchor').dispatchEvent(evt); 21 document.getElementById('anchor').dispatchEvent(evt);
22 } 22 }
23 23
24 function runTestStep() { 24 function runTestStep() {
25 var hash = location.hash; 25 var hash = location.hash;
26 var field = document.getElementById('field'); 26 var field = document.getElementById('field');
27 27
28 if (hash == "") { 28 if (hash == "") {
29 if (window.testRunner) { 29 if (window.testRunner) {
30 testRunner.dumpAsText(); 30 testRunner.dumpAsText();
31 testRunner.waitUntilDone(); 31 testRunner.waitUntilDone();
32 } 32 }
33 // Location changes need to happen outside the onload handler to generate hi story entries. 33 // Location changes need to happen outside the onload handler to generate hi story entries.
34 setTimeout(function() { 34 setTimeout(function() {
35 navigateToHash(field); 35 navigateToHash(field);
36 navigateAwayAndBack(); 36 navigateAwayAndBack();
37 }, 0); 37 }, 0);
38 } else { 38 } else {
39 document.body.innerHTML = (field.value == '') ? 'FAIL' : 'PASS'; 39 document.body.innerHTML = (field.value == '') ? 'FAIL' : 'PASS';
40 if (window.testRunner) 40 if (window.testRunner)
41 testRunner.notifyDone(); 41 testRunner.notifyDone();
42 } 42 }
43 } 43 }
44 44
45 </script> 45 </script>
46 <body onload='runTestStep()' onunload='/*suppress page cache*/'> 46 <body onload='runTestStep()' onunload='/*suppress page cache*/'>
47 <input id='field'></input> 47 <input id='field'></input>
48 <a id='anchor' href='data:text/html,<body onload="history.back()"></body>'>go away and come back</a> 48 <a id='anchor' href='resources/back-on-load.html'>go away and come back</a>
49 </body> 49 </body>
50 </html> 50 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698