Bug 116709

Summary: Improve loader/go-back-cached-main-resource.html test
Product: WebKit Reporter: Manuel Rego Casasnovas <rego>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

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]
Patch
Comment 2 Alexey Proskuryakov 2013-05-24 09:54:33 PDT
Comment on attachment 202782 [details]
Patch

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]
Patch

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.