Bug 27281 - Fails to save document state when navigating away from a page with a reference fragment
Summary: Fails to save document state when navigating away from a page with a referenc...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: History (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Darin Fisher (:fishd, Google)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-14 16:11 PDT by Darin Fisher (:fishd, Google)
Modified: 2009-07-14 22:10 PDT (History)
1 user (show)

See Also:


Attachments
testcase (765 bytes, text/html)
2009-07-14 16:11 PDT, Darin Fisher (:fishd, Google)
no flags Details
v1 patch (4.03 KB, patch)
2009-07-14 17:07 PDT, Darin Fisher (:fishd, Google)
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Fisher (:fishd, Google) 2009-07-14 16:11:52 PDT
Created attachment 32746 [details]
testcase

Fails to save document state when navigating away from a page
with a reference fragment

Note: This only impacts WebKit when the page also has an unload
handler causing the page cache to be suppressed.

See the attached testcase, but roughly here's the repro steps:

1- Load an HTML page with empty input field
2- Load the same URL, but add a reference fragment to the URL
3- Type in the input field
4- Navigate to another host
5- Navigate back

The values you typed in the input field should be restored, but
if the page had an unload handler, then the values will not be
restored.

The bug is with HistoryItem::isCurrentDocument.  I believe that
it should be using equalIgnoringRef instead of operator== to
compare URLs.
Comment 1 Darin Fisher (:fishd, Google) 2009-07-14 16:15:26 PDT
Patch coming up...
Comment 2 Darin Fisher (:fishd, Google) 2009-07-14 17:07:09 PDT
Created attachment 32748 [details]
v1 patch

Simple patch.  Use equalIgnoringRef to compare the HistoryItem's URL the URL of a document.
Comment 3 Darin Adler 2009-07-14 17:09:38 PDT
Comment on attachment 32748 [details]
v1 patch

> -    return urlString() == doc->url();
> +    return equalIgnoringRef(KURL(urlString()), doc->url());

I would write url() instead of KURL(urlString()).

r=me
Comment 4 Darin Fisher (:fishd, Google) 2009-07-14 17:20:23 PDT
> I would write url() instead of KURL(urlString()).
> 
> r=me

Oh, good catch.  I forgot about that accessor.  Thanks!
Comment 5 Darin Fisher (:fishd, Google) 2009-07-14 22:10:46 PDT
Landed as http://trac.webkit.org/changeset/45890