Improve loader/go-back-cached-main-resource.html test

https://bugs.webkit.org/show_bug.cgi?id=116709

Patch by Manuel Rego Casasnovas <rego@igalia.com> on 2013-05-24
Reviewed by Alexey Proskuryakov.

It is only needed to register the listeners on the initial load as they
are already present when restoring from page cache. Modified the test to
use event.persisted property to know if we are handling the first load
in order to register the listeners only once.

* loader/resources/first-page.html: Rename registerListeners() function
to a more accurate name didShowPage() and use event.persisted to
register the listeners only in the first load.
* loader/resources/other-page.html: Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150645 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 265e4ab9
2013-05-24 Manuel Rego Casasnovas <rego@igalia.com>
Improve loader/go-back-cached-main-resource.html test
https://bugs.webkit.org/show_bug.cgi?id=116709
Reviewed by Alexey Proskuryakov.
It is only needed to register the listeners on the initial load as they
are already present when restoring from page cache. Modified the test to
use event.persisted property to know if we are handling the first load
in order to register the listeners only once.
* loader/resources/first-page.html: Rename registerListeners() function
to a more accurate name didShowPage() and use event.persisted to
register the listeners only in the first load.
* loader/resources/other-page.html: Ditto.
2013-05-24 Noam Rosenthal <noam@webkit.org>
WebProcess is crashing on http://achicu.github.io/css-presentation when direct pattern compositing is enabled
......
<html>
<head>
<script>
function registerListeners() {
function didShowPage() {
// Notify opener.
opener.postMessage('first-page', '*');
// Our opener will tell us to perform various loads.
window.addEventListener('message', function(event) {
// We register the listeners in the initial load (this is not needed
// when the page is restored from cache).
if (!event.persisted) {
// Our opener will tell us to perform various loads.
window.addEventListener('message', function(event) {
// Navigate to other page.
if (event.data === 'navigate-other-page') {
window.location = 'other-page.html';
return;
}
// Navigate to other page.
if (event.data === 'navigate-other-page') {
window.location = 'other-page.html';
return;
}
}, false);
}, false);
}
}
</script>
</head>
<body onpageshow="registerListeners();">
<body onpageshow="didShowPage();">
</body>
</html>
<html>
<head>
<script>
function registerListeners() {
function didShowPage() {
// Notify opener.
opener.postMessage('other-page', '*');
// Our opener will tell us to perform various loads.
window.addEventListener('message', function(event) {
// We register the listeners in the initial load (this is not needed
// when the page is restored from cache).
if (!event.persisted) {
// Our opener will tell us to perform various loads.
window.addEventListener('message', function(event) {
// Navigate first resource.
if (event.data === 'navigate-first-page') {
window.location = 'first-page.html';
return;
}
// Navigate first resource.
if (event.data === 'navigate-first-page') {
window.location = 'first-page.html';
return;
}
// Navigate back.
if (event.data === 'navigate-back') {
window.history.back();
return;
}
// Navigate back.
if (event.data === 'navigate-back') {
window.history.back();
return;
}
}, false);
}, false);
}
}
</script>
</head>
<body onpageshow="registerListeners();">
<body onpageshow="didShowPage();">
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment