Diff
Modified: branches/safari-601-branch/LayoutTests/ChangeLog (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/ChangeLog 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/ChangeLog 2015-12-09 18:53:17 UTC (rev 193845)
@@ -1,3 +1,40 @@
+2015-12-09 Babak Shafiei <bshaf...@apple.com>
+
+ Merge r190505.
+
+ 2015-10-02 Antoine Quint <grao...@apple.com>
+
+ popstate is fired at the wrong time on load
+ https://bugs.webkit.org/show_bug.cgi?id=94265
+
+ Reviewed by Darin Adler.
+
+ Updating tests that relied on a "popstate" event being fired at page load.
+
+ * fast/history/same-document-iframes-changing-fragment-expected.txt:
+ * fast/history/same-document-iframes-changing-pushstate-expected.txt:
+ * fast/loader/_javascript_-url-iframe-remove-on-navigate.html:
+ * fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html:
+ * fast/loader/stateobjects/document-destroyed-navigate-back.html:
+ * fast/loader/stateobjects/popstate-after-load-complete-addeventlistener.html:
+ * fast/loader/stateobjects/popstate-after-load-complete-body-attribute.html:
+ * fast/loader/stateobjects/popstate-after-load-complete-body-inline-attribute.html:
+ * fast/loader/stateobjects/popstate-after-load-complete-window-attribute.html:
+ * fast/loader/stateobjects/popstate-fires-on-history-traversal-expected.txt:
+ * fast/loader/stateobjects/popstate-fires-on-history-traversal.html:
+ * fast/loader/stateobjects/popstate-fires-with-page-cache-expected.txt:
+ * fast/loader/stateobjects/popstate-fires-with-page-cache.html:
+ * fast/loader/stateobjects/pushstate-object-types.html:
+ * fast/loader/stateobjects/pushstate-then-replacestate.html:
+ * fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange.html:
+ * fast/loader/stateobjects/replacestate-then-pushstate.html:
+ * fast/loader/stateobjects/resources/popstate-fires-with-page-cache-1.html:
+ * fast/loader/stateobjects/resources/popstate-fires-with-page-cache-2.html:
+ * fast/loader/stateobjects/resources/replacestate-in-iframe-window-child.html:
+ * http/tests/history/popstate-fires-with-pending-requests.html:
+ * http/tests/navigation/redirect-on-back-updates-history-item-expected.txt:
+ * http/tests/navigation/redirect-on-reload-updates-history-item-expected.txt:
+
2015-12-08 Babak Shafiei <bshaf...@apple.com>
Merge r191731.
Modified: branches/safari-601-branch/LayoutTests/fast/history/same-document-iframes-changing-fragment-expected.txt (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/history/same-document-iframes-changing-fragment-expected.txt 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/history/same-document-iframes-changing-fragment-expected.txt 2015-12-09 18:53:17 UTC (rev 193845)
@@ -3,7 +3,6 @@
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
Modified: branches/safari-601-branch/LayoutTests/fast/history/same-document-iframes-changing-pushstate-expected.txt (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/history/same-document-iframes-changing-pushstate-expected.txt 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/history/same-document-iframes-changing-pushstate-expected.txt 2015-12-09 18:53:17 UTC (rev 193845)
@@ -3,7 +3,6 @@
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
Modified: branches/safari-601-branch/LayoutTests/fast/loader/_javascript_-url-iframe-remove-on-navigate.html (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/_javascript_-url-iframe-remove-on-navigate.html 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/_javascript_-url-iframe-remove-on-navigate.html 2015-12-09 18:53:17 UTC (rev 193845)
@@ -9,7 +9,7 @@
document.getElementById("target").src = ""
}, 0);
-window.addEventListener("popstate", function() {
+window.addEventListener("load", function() {
document.write("PASS - _javascript_ URL blocked without crashing.");
if (window.testRunner)
testRunner.notifyDone();
Modified: branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html 2015-12-09 18:53:17 UTC (rev 193845)
@@ -48,20 +48,8 @@
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 @@
}
</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.
Modified: branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html 2015-12-09 18:53:17 UTC (rev 193845)
@@ -42,20 +42,8 @@
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 @@
}
</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.
Modified: branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-addeventlistener.html (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-addeventlistener.html 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-addeventlistener.html 2015-12-09 18:53:17 UTC (rev 193845)
@@ -20,18 +20,8 @@
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 @@
window.addEventListener("popstate", statePopped);
</script>
-<body>
+<body _onload_="runTest();">
<pre>
This test does the following:
-Listens for the popstate event using addEventListener
Modified: branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-body-attribute.html (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-body-attribute.html 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-body-attribute.html 2015-12-09 18:53:17 UTC (rev 193845)
@@ -20,18 +20,8 @@
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 @@
}
</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)
Modified: branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-body-inline-attribute.html (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-body-inline-attribute.html 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-body-inline-attribute.html 2015-12-09 18:53:17 UTC (rev 193845)
@@ -20,18 +20,8 @@
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 @@
}
</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)
Modified: branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-window-attribute.html (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-window-attribute.html 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-after-load-complete-window-attribute.html 2015-12-09 18:53:17 UTC (rev 193845)
@@ -20,18 +20,8 @@
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 @@
window._onpopstate_ = statePopped;
</script>
-<body>
+<body _onload_="runTest();">
<pre>
This test does the following:
-Uses window.onpopstate to add a popstate handler
Modified: branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-fires-on-history-traversal-expected.txt (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-fires-on-history-traversal-expected.txt 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-fires-on-history-traversal-expected.txt 2015-12-09 18:53:17 UTC (rev 193845)
@@ -2,7 +2,6 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-popstate fired with state null
setting hash to #state1
popstate fired with state null
setting hash to #state2
@@ -11,7 +10,7 @@
popstate fired with state null
going back
popstate fired with state null
-PASS popstateFireCount is 5
+PASS popstateFireCount is 4
PASS successfullyParsed is true
TEST COMPLETE
Modified: branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-fires-on-history-traversal.html (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-fires-on-history-traversal.html 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-fires-on-history-traversal.html 2015-12-09 18:53:17 UTC (rev 193845)
@@ -41,7 +41,7 @@
// 3. Navigating to #state2
// 4. Going back to #state1
// 5. Going back to the initial page state
- shouldBe('popstateFireCount', '5');
+ shouldBe('popstateFireCount', '4');
finishJSTest();
return;
default:
Modified: branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-fires-with-page-cache-expected.txt (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-fires-with-page-cache-expected.txt 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-fires-with-page-cache-expected.txt 2015-12-09 18:53:17 UTC (rev 193845)
@@ -2,10 +2,10 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-popstate fired with state null
+load fired
pushState with new state object for page 1
going to page 2
-popstate fired with state null
+load fired
going back to page 1 with new state object
popstate fired with state newState
going back to page 1 in initial state
Modified: branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-fires-with-page-cache.html (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-fires-with-page-cache.html 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/popstate-fires-with-page-cache.html 2015-12-09 18:53:17 UTC (rev 193845)
@@ -20,8 +20,32 @@
testFailed('Could not open test window');
}
+var testWindowLoadFireCount = 0;
var testWindowPopstateFireCount = 0;
+function onTestWindowLoad(event)
+{
+ debug('load fired');
+ testWindowLoadFireCount++;
+
+ switch (testWindowLoadFireCount) {
+ case 1:
+ debug('pushState with new state object for page 1');
+ testWindow.history.pushState('newState');
+ debug('going to page 2');
+ // Set the location in a timeout to generate a history entry
+ setTimeout(function() {testWindow.location.href = '';}, 0);
+ break;
+ case 2:
+ debug('going back to page 1 with new state object');
+ setTimeout(function() {testWindow.history.back();}, 0);
+ break;
+ default:
+ testFailed('unexpected load event state');
+ break;
+ }
+}
+
function onTestWindowPopState(event)
{
debug('popstate fired with state ' + event.state);
@@ -29,21 +53,10 @@
switch (testWindowPopstateFireCount) {
case 1:
- debug('pushState with new state object for page 1');
- testWindow.history.pushState('newState');
- debug('going to page 2');
- // Set the location in a timeout to generate a history entry
- setTimeout(function() {testWindow.location.href = '';}, 0);
- break;
- case 2:
- debug('going back to page 1 with new state object');
- setTimeout(function() {testWindow.history.back();}, 0);
- break;
- case 3:
debug('going back to page 1 in initial state');
setTimeout(function() {testWindow.history.back();}, 0);
break;
- case 4:
+ case 2:
// Close the window in a timeout to simulate popstate firing asynchronously, otherwise closing the window in a popstate handler results in a crash.
// FIXME: remove this when http://webkit.org/b/36202 is fixed.
setTimeout(function() {
Modified: branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/pushstate-object-types.html (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/pushstate-object-types.html 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/pushstate-object-types.html 2015-12-09 18:53:17 UTC (rev 193845)
@@ -39,18 +39,8 @@
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
@@ -64,7 +54,7 @@
}
</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>
Modified: branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/pushstate-then-replacestate.html (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/pushstate-then-replacestate.html 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/pushstate-then-replacestate.html 2015-12-09 18:53:17 UTC (rev 193845)
@@ -22,18 +22,8 @@
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 @@
}
</script>
-<body>
+<body _onload_="runTest();">
<pre>
This test does the following:
-Makes a call to pushState()
Modified: branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange.html (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange.html 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange.html 2015-12-09 18:53:17 UTC (rev 193845)
@@ -44,18 +44,8 @@
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 @@
}
</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>
Modified: branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/replacestate-then-pushstate.html (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/replacestate-then-pushstate.html 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/replacestate-then-pushstate.html 2015-12-09 18:53:17 UTC (rev 193845)
@@ -22,18 +22,8 @@
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 @@
}
</script>
-<body>
+<body _onload_="runTest();">
<pre>
This test does the following:
-Makes a call to replaceState()
Modified: branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/resources/popstate-fires-with-page-cache-1.html (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/resources/popstate-fires-with-page-cache-1.html 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/resources/popstate-fires-with-page-cache-1.html 2015-12-09 18:53:17 UTC (rev 193845)
@@ -1 +1 @@
-<body _onpopstate_="opener.onTestWindowPopState(event)">page 1</body>
\ No newline at end of file
+<body _onload_="opener.onTestWindowLoad(event)" _onpopstate_="opener.onTestWindowPopState(event)">page 1</body>
\ No newline at end of file
Modified: branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/resources/popstate-fires-with-page-cache-2.html (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/resources/popstate-fires-with-page-cache-2.html 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/resources/popstate-fires-with-page-cache-2.html 2015-12-09 18:53:17 UTC (rev 193845)
@@ -1 +1 @@
-<body _onpopstate_="opener.onTestWindowPopState(event)">page 2</body>
\ No newline at end of file
+<body _onload_="opener.onTestWindowLoad(event)" _onpopstate_="opener.onTestWindowPopState(event)">page 2</body>
\ No newline at end of file
Modified: branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/resources/replacestate-in-iframe-window-child.html (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/resources/replacestate-in-iframe-window-child.html 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/fast/loader/stateobjects/resources/replacestate-in-iframe-window-child.html 2015-12-09 18:53:17 UTC (rev 193845)
@@ -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");
}
Modified: branches/safari-601-branch/LayoutTests/http/tests/history/popstate-fires-with-pending-requests.html (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/http/tests/history/popstate-fires-with-pending-requests.html 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/http/tests/history/popstate-fires-with-pending-requests.html 2015-12-09 18:53:17 UTC (rev 193845)
@@ -10,17 +10,8 @@
<script>
description('Tests that popstate events fire when going back, even when there are resource requests pending.');
-_onpopstate_ = function(event)
+window._onload_ = function(event)
{
- 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');
@@ -43,6 +34,13 @@
}, 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>
Modified: branches/safari-601-branch/LayoutTests/http/tests/navigation/redirect-on-back-updates-history-item-expected.txt (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/http/tests/navigation/redirect-on-back-updates-history-item-expected.txt 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/http/tests/navigation/redirect-on-back-updates-history-item-expected.txt 2015-12-09 18:53:17 UTC (rev 193845)
@@ -1,8 +1,6 @@
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 **nav target**
curr-> http://127.0.0.1:8000/navigation/resources/redirect-updates-history-item-done.html **nav target**
Modified: branches/safari-601-branch/LayoutTests/http/tests/navigation/redirect-on-reload-updates-history-item-expected.txt (193844 => 193845)
--- branches/safari-601-branch/LayoutTests/http/tests/navigation/redirect-on-reload-updates-history-item-expected.txt 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/LayoutTests/http/tests/navigation/redirect-on-reload-updates-history-item-expected.txt 2015-12-09 18:53:17 UTC (rev 193845)
@@ -1,9 +1,7 @@
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 **nav target**
curr-> http://127.0.0.1:8000/navigation/resources/redirect-updates-history-item-done.html **nav target**
Modified: branches/safari-601-branch/Source/WebCore/ChangeLog (193844 => 193845)
--- branches/safari-601-branch/Source/WebCore/ChangeLog 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/Source/WebCore/ChangeLog 2015-12-09 18:53:17 UTC (rev 193845)
@@ -1,3 +1,31 @@
+2015-12-09 Babak Shafiei <bshaf...@apple.com>
+
+ Merge r190505.
+
+ 2015-10-02 Antoine Quint <grao...@apple.com>
+
+ popstate is fired at the wrong time on load
+ https://bugs.webkit.org/show_bug.cgi?id=94265
+
+ Reviewed by Darin Adler.
+
+ Don't fire popstate event on initial document load
+
+ According to the specification [1], a popstate event should only be fired
+ when the document has a "last entry" and the entry being navigated to isn't
+ it. A document is created without a "last entry" and gets one just after
+ this check when it is first navigated to, so a popstate should be fired any
+ time a document is navigated to except for the first time after it has been
+ created.
+
+ Patch adapted from work by j...@opera.com on Blink [2].
+
+ [1] http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#traverse-the-history (step 12-14 in particular)
+ [2] https://src.chromium.org/viewvc/blink?revision=165221&view=revision
+
+ * dom/Document.cpp:
+ (WebCore::Document::implicitClose):
+
2015-12-08 Babak Shafiei <bshaf...@apple.com>
Merge r191748.
Modified: branches/safari-601-branch/Source/WebCore/dom/Document.cpp (193844 => 193845)
--- branches/safari-601-branch/Source/WebCore/dom/Document.cpp 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/Source/WebCore/dom/Document.cpp 2015-12-09 18:53:17 UTC (rev 193845)
@@ -2613,7 +2613,8 @@
dispatchWindowLoadEvent();
enqueuePageshowEvent(PageshowEventNotPersisted);
- enqueuePopstateEvent(m_pendingStateObject ? m_pendingStateObject.release() : SerializedScriptValue::nullValue());
+ if (m_pendingStateObject)
+ enqueuePopstateEvent(m_pendingStateObject.release());
if (f)
f->loader().handledOnloadEvents();
Modified: branches/safari-601-branch/Source/WebKit2/ChangeLog (193844 => 193845)
--- branches/safari-601-branch/Source/WebKit2/ChangeLog 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/Source/WebKit2/ChangeLog 2015-12-09 18:53:17 UTC (rev 193845)
@@ -1,3 +1,20 @@
+2015-12-09 Babak Shafiei <bshaf...@apple.com>
+
+ Merge r190505.
+
+ 2015-10-02 Antoine Quint <grao...@apple.com>
+
+ popstate is fired at the wrong time on load
+ https://bugs.webkit.org/show_bug.cgi?id=94265
+
+ Reviewed by Darin Adler.
+
+ Ensure we have a valid page before trying to get to its drawingArea as this could lead
+ to a crash as observed with fast/loader/stateobjects/pushstate-object-types.html.
+
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::restoreViewState):
+
2015-10-18 Myles C. Maxfield <mmaxfi...@apple.com>
Stop honoring the user default "WebKitKerningAndLigaturesEnabledByDefault"
Modified: branches/safari-601-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (193844 => 193845)
--- branches/safari-601-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2015-12-09 18:52:16 UTC (rev 193844)
+++ branches/safari-601-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2015-12-09 18:53:17 UTC (rev 193845)
@@ -1214,7 +1214,7 @@
// FIXME: This should not be necessary. WebCore should be correctly invalidating
// the view on restores from the back/forward cache.
- if (m_frame == m_frame->page()->mainWebFrame())
+ if (m_frame->page() && m_frame == m_frame->page()->mainWebFrame())
m_frame->page()->drawingArea()->setNeedsDisplay();
#endif
}