RESOLVED FIXED 116670
Fix loader/go-back-cached-main-resource.html test
https://bugs.webkit.org/show_bug.cgi?id=116670
Summary Fix loader/go-back-cached-main-resource.html test
Manuel Rego Casasnovas
Reported 2013-05-23 07:19:16 PDT
This bug is to fix the issue explained in comment the following comment about loader/go-back-cached-main-resource.html layout test: https://bugs.webkit.org/show_bug.cgi?id=112418#c29 Comment by "Alexey Proskuryakov": > (From update of attachment 197215 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=197215&action=review > > > LayoutTests/loader/go-back-cached-main-resource.html:36 > > + target.postMessage('navigate-back', '*'); > > + // Wait a bit for resource load callbacks > > + setTimeout(function () { > > It is expected that the page does not get an onload when being restored from page cache, so a 'first-page' message is not sent. > > A better way to check for page being restored from page cache is to handle pageshow event on it.
Attachments
Patch (2.90 KB, patch)
2013-05-23 07:25 PDT, Manuel Rego Casasnovas
no flags
Manuel Rego Casasnovas
Comment 1 2013-05-23 07:25:08 PDT
Alexey Proskuryakov
Comment 2 2013-05-23 10:29:29 PDT
Comment on attachment 202708 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=202708&action=review Getting rid of the timeout is a very welcome improvement, so r=me. Please consider the suggestion below. > LayoutTests/loader/resources/first-page.html:21 > +<body onpageshow="registerListeners();"> This is quite misleading. We only need to register listeners on first load, they are already present when restoring from cache. But the function does more than its name says, which is why it's necessary to call it every time! One way to clean this up would be to rename the function to "didShowPage", and use event.persisted property to check if we are handling the initial load. Or just use an anonymous function, and register it as window.onpageshow = function (event) { ... }
WebKit Commit Bot
Comment 3 2013-05-23 10:52:34 PDT
Comment on attachment 202708 [details] Patch Clearing flags on attachment: 202708 Committed r150594: <http://trac.webkit.org/changeset/150594>
WebKit Commit Bot
Comment 4 2013-05-23 10:52:36 PDT
All reviewed patches have been landed. Closing bug.
Manuel Rego Casasnovas
Comment 5 2013-05-24 03:42:36 PDT
(In reply to comment #2) > (From update of attachment 202708 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=202708&action=review > > Getting rid of the timeout is a very welcome improvement, so r=me. Please consider the suggestion below. Thanks for the review. > > LayoutTests/loader/resources/first-page.html:21 > > +<body onpageshow="registerListeners();"> > > This is quite misleading. We only need to register listeners on first load, they are already present when restoring from cache. But the function does more than its name says, which is why it's necessary to call it every time! > > One way to clean this up would be to rename the function to "didShowPage", and use event.persisted property to check if we are handling the initial load. Or just use an anonymous function, and register it as window.onpageshow = function (event) { ... } Thanks for the information, I've changed the test in a new bug #116709 in order to register listeners only on initial load.
Note You need to log in before you can comment on or make changes to this bug.