summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--third_party/WebKit/LayoutTests/fast/history/same-document-iframes-changing-fragment-expected.txt1
-rw-r--r--third_party/WebKit/LayoutTests/fast/history/same-document-iframes-changing-pushstate-expected.txt1
-rw-r--r--third_party/WebKit/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html14
-rw-r--r--third_party/WebKit/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html14
-rw-r--r--third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-addeventlistener.html12
-rw-r--r--third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-body-attribute.html12
-rw-r--r--third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-body-inline-attribute.html12
-rw-r--r--third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-window-attribute.html12
-rw-r--r--third_party/WebKit/LayoutTests/fast/loader/stateobjects/pushstate-object-types.html13
-rw-r--r--third_party/WebKit/LayoutTests/fast/loader/stateobjects/pushstate-then-replacestate.html12
-rw-r--r--third_party/WebKit/LayoutTests/fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange.html12
-rw-r--r--third_party/WebKit/LayoutTests/fast/loader/stateobjects/replacestate-then-pushstate.html12
-rw-r--r--third_party/WebKit/LayoutTests/fast/loader/stateobjects/resources/pushstate-in-iframe-child.html8
-rw-r--r--third_party/WebKit/LayoutTests/fast/loader/stateobjects/resources/replacestate-in-iframe-window-child.html17
-rw-r--r--third_party/WebKit/LayoutTests/http/tests/history/popstate-fires-with-pending-requests.html29
-rw-r--r--third_party/WebKit/LayoutTests/http/tests/navigation/redirect-on-back-updates-history-item-expected.txt2
-rw-r--r--third_party/WebKit/LayoutTests/http/tests/navigation/redirect-on-reload-updates-history-item-expected.txt2
-rw-r--r--third_party/WebKit/Source/core/frame/DOMWindow.cpp3
18 files changed, 35 insertions, 153 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/history/same-document-iframes-changing-fragment-expected.txt b/third_party/WebKit/LayoutTests/fast/history/same-document-iframes-changing-fragment-expected.txt
index c9ac3b1..af1f735 100644
--- a/third_party/WebKit/LayoutTests/fast/history/same-document-iframes-changing-fragment-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/history/same-document-iframes-changing-fragment-expected.txt
@@ -3,7 +3,6 @@ Tests that we trigger same-document navigation when history entries are generate
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-popstate to state: null filename: same-document-iframes-changing-fragment.html
removing iframe2
navigating to #newState
popstate to state: null filename: same-document-iframes-changing-fragment.html#newState
diff --git a/third_party/WebKit/LayoutTests/fast/history/same-document-iframes-changing-pushstate-expected.txt b/third_party/WebKit/LayoutTests/fast/history/same-document-iframes-changing-pushstate-expected.txt
index 38f28df..aa6acb6 100644
--- a/third_party/WebKit/LayoutTests/fast/history/same-document-iframes-changing-pushstate-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/history/same-document-iframes-changing-pushstate-expected.txt
@@ -3,7 +3,6 @@ Tests that we trigger same-document navigation when history entries are generate
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-popstate to state: null filename: same-document-iframes-changing-pushstate.html
removing iframe2
pushState to newState
going back
diff --git a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html
index 1f870cc..67bf15c 100644
--- a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html
+++ b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html
@@ -48,20 +48,8 @@ function runTest()
runThirdStageOfTest();
}
-var beganTest = false;
-
onpopstate = function()
{
- // The first time popstate fires, it's because the page has finished loading.
- // Only then can we begin the test.
- if (!beganTest) {
- beganTest = true;
- runTest();
- // Continue with the handler if we've already began the test.
- if (!sessionStorage.stage)
- return;
- }
-
alert("State popped - " + event.state + " (type " + typeof event.state + ")");
// FIXME: Once the popstate and hashchange events fire asynchronously, we
@@ -96,7 +84,7 @@ onhashchange = function(event)
}
</script>
-<body onunload="/* disable page cache */">
+<body onload="runTest();" onunload="/* disable page cache */">
<pre>
This test:
-Builds up a list of state object entries with fragment URLs.
diff --git a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html
index 6776db6..02937d2 100644
--- a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html
+++ b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html
@@ -42,20 +42,8 @@ function runTest()
runThirdStageOfTest();
}
-var beganTest = false;
-
function statePopped()
{
- // The first time popstate fires, it's because the page has finished loading.
- // Only then can we begin the test.
- if (!beganTest) {
- beganTest = true;
- runTest();
- // Continue with the handler if we've already began the test.
- if (!sessionStorage.stage)
- return;
- }
-
alert("State popped - " + event.state + " (type " + typeof event.state + ")");
if (event.state == "FirstEntry") {
history.replaceState("FirstEntryWillLaterBeReactivated", null, "?FirstEntryWillLaterBeReactivated");
@@ -74,7 +62,7 @@ function statePopped()
}
</script>
-<body onpopstate="statePopped();" onunload="/* disable page cache */">
+<body onload="runTest();" onpopstate="statePopped();" onunload="/* disable page cache */">
<pre>
This test:
-Builds up a list of state object entries with fragment URLs.
diff --git a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-addeventlistener.html b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-addeventlistener.html
index 6111ab4..2a01679 100644
--- a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-addeventlistener.html
+++ b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-addeventlistener.html
@@ -20,18 +20,8 @@ function runTest()
history.back();
}
-var beganTest = false;
-
function statePopped()
{
- // The first time popstate fires, it's because the page has finished loading.
- // Only then can we begin the test.
- if (!beganTest) {
- beganTest = true;
- runTest();
- return;
- }
-
log("State popped - " + event.state + " (type " + typeof event.state + ")");
if (event.state == null)
history.forward();
@@ -42,7 +32,7 @@ function statePopped()
window.addEventListener("popstate", statePopped);
</script>
-<body>
+<body onload="runTest();">
<pre>
This test does the following:
-Listens for the popstate event using addEventListener
diff --git a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-body-attribute.html b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-body-attribute.html
index 62959d2..8ee1d99 100644
--- a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-body-attribute.html
+++ b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-body-attribute.html
@@ -20,18 +20,8 @@ function runTest()
history.back();
}
-var beganTest = false;
-
function statePopped()
{
- // The first time popstate fires, it's because the page has finished loading.
- // Only then can we begin the test.
- if (!beganTest) {
- beganTest = true;
- runTest();
- return;
- }
-
log("State popped - " + event.state + " (type " + typeof event.state + ")");
if (event.state == null) {
document.body.onpopstate = statePopped;
@@ -41,7 +31,7 @@ function statePopped()
}
</script>
-<body>
+<body onload="runTest();">
<pre>
This test does the following:
-Uses body.onpopstate to add a popstate handler (both by using the inline attribute and a script-assigned attribute)
diff --git a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-body-inline-attribute.html b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-body-inline-attribute.html
index 8ad8bf5..78e6cec 100644
--- a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-body-inline-attribute.html
+++ b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-body-inline-attribute.html
@@ -20,18 +20,8 @@ function runTest()
history.back();
}
-var beganTest = false;
-
function statePopped()
{
- // The first time popstate fires, it's because the page has finished loading.
- // Only then can we begin the test.
- if (!beganTest) {
- beganTest = true;
- runTest();
- return;
- }
-
log("State popped - " + event.state + " (type " + typeof event.state + ")");
if (event.state == null) {
document.body.onpopstate = statePopped;
@@ -41,7 +31,7 @@ function statePopped()
}
</script>
-<body onpopstate="statePopped();">
+<body onload="runTest();" onpopstate="statePopped();">
<pre>
This test does the following:
-Uses body.onpopstate to add a popstate handler (both by using the inline attribute and a script-assigned attribute)
diff --git a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-window-attribute.html b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-window-attribute.html
index 2f606f6..81267c7 100644
--- a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-window-attribute.html
+++ b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-window-attribute.html
@@ -20,18 +20,8 @@ function runTest()
history.back();
}
-var beganTest = false;
-
function statePopped()
{
- // The first time popstate fires, it's because the page has finished loading.
- // Only then can we begin the test.
- if (!beganTest) {
- beganTest = true;
- runTest();
- return;
- }
-
log("State popped - " + event.state + " (type " + typeof event.state + ")");
if (event.state == null)
history.forward();
@@ -42,7 +32,7 @@ function statePopped()
window.onpopstate = statePopped;
</script>
-<body>
+<body onload="runTest();">
<pre>
This test does the following:
-Uses window.onpopstate to add a popstate handler
diff --git a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/pushstate-object-types.html b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/pushstate-object-types.html
index 7973579..097aec4 100644
--- a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/pushstate-object-types.html
+++ b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/pushstate-object-types.html
@@ -39,24 +39,13 @@ history.pushState([FileList], "FileList entry");
history.back();
}
-var beganTest = false;
-
onpopstate = function(event)
{
- // The first time popstate fires, it's because the page has finished loading.
- // Only then can we begin the test.
- if (!beganTest) {
- beganTest = true;
- runTest();
- return;
- }
-
if (event.state instanceof Date)
log("State popped - " + event.state.getTime() + " (type " + typeof event.state + ")");
else
log("State popped - " + event.state + " (type " + typeof event.state + ")");
-
if (event.state != "FirstEntry")
history.back();
else if (window.testRunner)
@@ -64,7 +53,7 @@ onpopstate = function(event)
}
</script>
-<body>
+<body onload="runTest();">
<p>
This test calls pushState with state objects of all the different object types supported by the HTML5 "internal structured cloning algorithm" and makes sure the events contain the expected objects when the states are popped.
</p>
diff --git a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/pushstate-then-replacestate.html b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/pushstate-then-replacestate.html
index 9ea3b97..d3de76e 100644
--- a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/pushstate-then-replacestate.html
+++ b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/pushstate-then-replacestate.html
@@ -22,18 +22,8 @@ function runTest()
history.back();
}
-var beganTest = false;
-
onpopstate = function(event)
{
- // The first time popstate fires, it's because the page has finished loading.
- // Only then can we begin the test.
- if (!beganTest) {
- beganTest = true;
- runTest();
- return;
- }
-
log("State popped - " + event.state + " (type " + typeof event.state + ")");
if (event.state == null)
history.forward();
@@ -42,7 +32,7 @@ onpopstate = function(event)
}
</script>
-<body>
+<body onload="runTest();">
<pre>
This test does the following:
-Makes a call to pushState()
diff --git a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange.html b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange.html
index d7605b77..98a429e 100644
--- a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange.html
+++ b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange.html
@@ -44,18 +44,8 @@ function lastPathComponent(url)
return url.split('/').pop();
}
-var beganTest = false;
-
onpopstate = function(event)
{
- // The first time popstate fires, it's because the page has finished loading.
- // Only then can we begin the test.
- if (!beganTest) {
- beganTest = true;
- runTest();
- return;
- }
-
log("State popped with event " + event.state + " (type " + typeof event.state + ") and last path component " + lastPathComponent(location.href));
if (event.state != "OriginalEntry")
setTimeout("history.back();", 0);
@@ -69,7 +59,7 @@ onhashchange = function(event)
}
</script>
-<body>
+<body onload="runTest();">
<pre>
This test pushes a series of state objects with different URLs and fragment identifiers meant to test the hashChange event as states are popped.
</pre><br>
diff --git a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/replacestate-then-pushstate.html b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/replacestate-then-pushstate.html
index b0dd81e..fbfa27a 100644
--- a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/replacestate-then-pushstate.html
+++ b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/replacestate-then-pushstate.html
@@ -22,18 +22,8 @@ function runTest()
history.back();
}
-var beganTest = false;
-
onpopstate = function(event)
{
- // The first time popstate fires, it's because the page has finished loading.
- // Only then can we begin the test.
- if (!beganTest) {
- beganTest = true;
- runTest();
- return;
- }
-
log("State popped - " + event.state + " (type " + typeof event.state + ")");
if (event.state == "OriginalHistoryItem")
history.forward();
@@ -42,7 +32,7 @@ onpopstate = function(event)
}
</script>
-<body>
+<body onload="runTest();">
<pre>
This test does the following:
-Makes a call to replaceState()
diff --git a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/resources/pushstate-in-iframe-child.html b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/resources/pushstate-in-iframe-child.html
index b5c6812..517ed73 100644
--- a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/resources/pushstate-in-iframe-child.html
+++ b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/resources/pushstate-in-iframe-child.html
@@ -3,15 +3,7 @@ onunload = function() {
// disable page cache
}
-var pageLoaded = false;
-
onpopstate = function() {
- // The first time popstate fires, it's because the page has finished loading.
- if (!pageLoaded) {
- pageLoaded = true;
- return;
- }
-
var topWin = top;
// Verify that we are still in an iframe
if (topWin == window) {
diff --git a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/resources/replacestate-in-iframe-window-child.html b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/resources/replacestate-in-iframe-window-child.html
index c83f9c8..970d6c4 100644
--- a/third_party/WebKit/LayoutTests/fast/loader/stateobjects/resources/replacestate-in-iframe-window-child.html
+++ b/third_party/WebKit/LayoutTests/fast/loader/stateobjects/resources/replacestate-in-iframe-window-child.html
@@ -1,15 +1,16 @@
<script>
-onunload = function() {
+window.onload = function() {
+ if (!sessionStorage.beganTest) {
+ sessionStorage.beganTest = true;
+ top.opener.windowLoaded();
+ }
+}
+
+window.onunload = function() {
// No page cache
}
-onpopstate = function(e) {
- if (!sessionStorage.beganTest) {
- sessionStorage.beganTest = true;
- top.opener.windowLoaded();
- return;
- }
-
+window.onpopstate = function(e) {
alert("onpopstate");
top.opener.notifyDone(window == parent ? "FAIL" : "PASS");
}
diff --git a/third_party/WebKit/LayoutTests/http/tests/history/popstate-fires-with-pending-requests.html b/third_party/WebKit/LayoutTests/http/tests/history/popstate-fires-with-pending-requests.html
index 0e09038..441dd88 100644
--- a/third_party/WebKit/LayoutTests/http/tests/history/popstate-fires-with-pending-requests.html
+++ b/third_party/WebKit/LayoutTests/http/tests/history/popstate-fires-with-pending-requests.html
@@ -10,29 +10,20 @@
<script>
description('Tests that popstate events fire when going back, even when there are resource requests pending.');
-onpopstate = function(event)
+window.onload = function()
{
- if (event.state) {
- shouldBe('event.state', '"newState1"');
- // Stop the pending image request, otherwise the DRT doesn't consider the
- // test over.
- window.stop();
- finishJSTest();
- return;
- }
-
debug('Starting slow image request');
-
+
var slowImage = document.createElement('img');
slowImage.src = 'resources/slow-image.php';
document.body.appendChild(slowImage);
-
+
debug('Pushing newState1');
history.pushState('newState1', null, '?newState1');
-
+
setTimeout(function() {
debug('Current search: ' + location.search);
-
+
debug('Pushing newState2');
history.pushState('newState2', null, '?newState2');
setTimeout(function() {
@@ -43,9 +34,17 @@ onpopstate = function(event)
}, 0);
}
+window.onpopstate = function(event)
+{
+ shouldBe('event.state', '"newState1"');
+ // Stop the pending image request, otherwise the DRT doesn't consider the
+ // test over.
+ window.stop();
+ finishJSTest();
+}
var jsTestIsAsync = true;
-</script>
+</script>
</body>
</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/navigation/redirect-on-back-updates-history-item-expected.txt b/third_party/WebKit/LayoutTests/http/tests/navigation/redirect-on-back-updates-history-item-expected.txt
index 20df074..b35671b 100644
--- a/third_party/WebKit/LayoutTests/http/tests/navigation/redirect-on-back-updates-history-item-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/navigation/redirect-on-back-updates-history-item-expected.txt
@@ -1,7 +1,5 @@
main frame - has 1 onunload handler(s)
PASS
-popstate: null
-
============== Back Forward List ==============
http://127.0.0.1:8000/navigation/redirect-on-back-updates-history-item.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/navigation/redirect-on-reload-updates-history-item-expected.txt b/third_party/WebKit/LayoutTests/http/tests/navigation/redirect-on-reload-updates-history-item-expected.txt
index 3fe8dd4..e991ef9 100644
--- a/third_party/WebKit/LayoutTests/http/tests/navigation/redirect-on-reload-updates-history-item-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/navigation/redirect-on-reload-updates-history-item-expected.txt
@@ -1,8 +1,6 @@
main frame - has 1 onunload handler(s)
main frame - has 1 onunload handler(s)
PASS
-popstate: null
-
============== Back Forward List ==============
http://127.0.0.1:8000/navigation/redirect-on-reload-updates-history-item.html
diff --git a/third_party/WebKit/Source/core/frame/DOMWindow.cpp b/third_party/WebKit/Source/core/frame/DOMWindow.cpp
index 1912f24..e52015a 100644
--- a/third_party/WebKit/Source/core/frame/DOMWindow.cpp
+++ b/third_party/WebKit/Source/core/frame/DOMWindow.cpp
@@ -450,7 +450,8 @@ void DOMWindow::documentWasClosed()
{
dispatchWindowLoadEvent();
enqueuePageshowEvent(PageshowEventNotPersisted);
- enqueuePopstateEvent(m_pendingStateObject ? m_pendingStateObject.release() : SerializedScriptValue::nullValue());
+ if (m_pendingStateObject)
+ enqueuePopstateEvent(m_pendingStateObject.release());
}
void DOMWindow::enqueuePageshowEvent(PageshowEventPersistence persisted)