Bug 116709 - Improve loader/go-back-cached-main-resource.html test
Summary: Improve loader/go-back-cached-main-resource.html test
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2013-05-24 01:13 PDT by Manuel Rego Casasnovas
Modified: 2013-05-24 10:16 PDT (History)
2 users (show)

See Also:

Patch (4.40 KB, patch)
2013-05-24 01:20 PDT, Manuel Rego Casasnovas
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel Rego Casasnovas 2013-05-24 01:13:48 PDT
This bug is to improve the loader/go-back-cached-main-resource.html test with the ideas from the following comment by Alexey Proskuryakov in bug #116670#c2:
> (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.
> > 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) { ... }
Comment 1 Manuel Rego Casasnovas 2013-05-24 01:20:16 PDT
Created attachment 202782 [details]
Comment 2 Alexey Proskuryakov 2013-05-24 09:54:33 PDT
Comment on attachment 202782 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=202782&action=review

Thank you!

> LayoutTests/loader/resources/first-page.html:11
> +        if (!event.persisted) {
> +            // Our opener will tell us to perform various loads.

Just for the information, WebKit style is to prefer early returns, not deep indentation.

I don't think that it's worth changing for this test, it's an extremely minor point.
Comment 3 WebKit Commit Bot 2013-05-24 10:16:03 PDT
Comment on attachment 202782 [details]

Clearing flags on attachment: 202782

Committed r150645: <http://trac.webkit.org/changeset/150645>
Comment 4 WebKit Commit Bot 2013-05-24 10:16:05 PDT
All reviewed patches have been landed.  Closing bug.