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

Side by Side Diff: LayoutTests/fast/loader/stateobjects/pushstate-object-types.html

Issue 136463002: Don't fire popstate event on initial document load (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix replacestate-in-iframe test Created 6 years, 11 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 <head> 2 <head>
3 <script> 3 <script>
4 4
5 if (window.testRunner) { 5 if (window.testRunner) {
6 testRunner.clearBackForwardList(); 6 testRunner.clearBackForwardList();
7 testRunner.dumpAsText(); 7 testRunner.dumpAsText();
8 testRunner.waitUntilDone(); 8 testRunner.waitUntilDone();
9 } 9 }
10 10
(...skipping 21 matching lines...) Expand all
32 /* The following are not yet well enough supported in WebKit to meaningfully tes t here: 32 /* The following are not yet well enough supported in WebKit to meaningfully tes t here:
33 history.pushState([Blob], "Blob entry"); 33 history.pushState([Blob], "Blob entry");
34 history.pushState([File], "File entry"); 34 history.pushState([File], "File entry");
35 history.pushState([FileList], "FileList entry"); 35 history.pushState([FileList], "FileList entry");
36 */ 36 */
37 37
38 history.pushState("BufferEntry", "Last entry"); 38 history.pushState("BufferEntry", "Last entry");
39 history.back(); 39 history.back();
40 } 40 }
41 41
42 var beganTest = false;
43
44 onpopstate = function(event) 42 onpopstate = function(event)
45 { 43 {
46 // The first time popstate fires, it's because the page has finished loading .
47 // Only then can we begin the test.
48 if (!beganTest) {
49 beganTest = true;
50 runTest();
51 return;
52 }
53
54 if (event.state instanceof Date) 44 if (event.state instanceof Date)
55 log("State popped - " + event.state.getTime() + " (type " + typeof event .state + ")"); 45 log("State popped - " + event.state.getTime() + " (type " + typeof event .state + ")");
56 else 46 else
57 log("State popped - " + event.state + " (type " + typeof event.state + " )"); 47 log("State popped - " + event.state + " (type " + typeof event.state + " )");
58 48
59
60 if (event.state != "FirstEntry") 49 if (event.state != "FirstEntry")
61 history.back(); 50 history.back();
62 else if (window.testRunner) 51 else if (window.testRunner)
63 testRunner.notifyDone(); 52 testRunner.notifyDone();
64 } 53 }
65 54
66 </script> 55 </script>
67 <body> 56 <body onload="runTest();">
68 <p> 57 <p>
69 This test calls pushState with state objects of all the different object types s upported by the HTML5 "internal structured cloning algorithm" and makes sure the events contain the expected objects when the states are popped. 58 This test calls pushState with state objects of all the different object types s upported by the HTML5 "internal structured cloning algorithm" and makes sure the events contain the expected objects when the states are popped.
70 </p> 59 </p>
71 <pre id="logger"></pre> 60 <pre id="logger"></pre>
72 </body> 61 </body>
73 </html> 62 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698