RESOLVED FIXED 39418
history.pushState doesn't work for the first page in a window.
https://bugs.webkit.org/show_bug.cgi?id=39418
Summary history.pushState doesn't work for the first page in a window.
Jędrzej Nowacki
Reported 2010-05-20 04:26:20 PDT
history.pushState doesn't do enything for the first page in a window. Bug was introduced by r59815 (bug 38840).
Attachments
Fix v1 (1.22 KB, patch)
2010-05-20 04:43 PDT, Jędrzej Nowacki
no flags
layout test v1 (2.31 KB, patch)
2010-05-25 08:16 PDT, Jędrzej Nowacki
beidson: review-
beidson: commit-queue-
layout test v2 (2.78 KB, patch)
2010-05-26 06:52 PDT, Jędrzej Nowacki
no flags
Jędrzej Nowacki
Comment 1 2010-05-20 04:43:31 PDT
Created attachment 56585 [details] Fix v1 Apparently it fix the bug 38754 too at least on my Linux machine.
WebKit Commit Bot
Comment 2 2010-05-21 08:01:33 PDT
Comment on attachment 56585 [details] Fix v1 Clearing flags on attachment: 56585 Committed r59933: <http://trac.webkit.org/changeset/59933>
WebKit Commit Bot
Comment 3 2010-05-21 08:01:39 PDT
All reviewed patches have been landed. Closing bug.
Brady Eidson
Comment 4 2010-05-21 10:30:16 PDT
This would've been easy to add a layouttest for, wouldn't it have?
Jędrzej Nowacki
Comment 5 2010-05-25 08:13:34 PDT
(In reply to comment #4) > This would've been easy to add a layouttest for, wouldn't it have? It will be a bit redundant, but easy :-)
Jędrzej Nowacki
Comment 6 2010-05-25 08:16:27 PDT
Created attachment 57020 [details] layout test v1 New test, after load event, calls the pushState a few times and check if it change the history length property.
Brady Eidson
Comment 7 2010-05-25 09:07:32 PDT
(In reply to comment #5) > (In reply to comment #4) > > This would've been easy to add a layouttest for, wouldn't it have? > It will be a bit redundant, but easy :-) I don't understand this comment. There was a bug - you couldn't call pushState after the initial load in a new window. If a layouttest was catching this case, then that layout test should've been failing. If a layouttest was NOT catching this case, then adding one would not be redundant.
Brady Eidson
Comment 8 2010-05-25 09:10:07 PDT
Comment on attachment 57020 [details] layout test v1 I'm r-'ing because I'm missing how this test actually works under the run-webkit-tests harness. Yes, if I open it in a new Safari window, for example, it would be exercising the code path that used to have this problem. But run-webkit-tests reuses the same WebView for a series of tests. Therefore - unless it goes first - this test won't actually excercise the buggy code path.
Brady Eidson
Comment 9 2010-05-25 09:12:27 PDT
There is a fairly simple invariant for layouttests. They need to fail before the WebKit code change is applied, and pass after the WebKit code change is applied. Unless I'm missing something, I don't see how this test would fail before r59933 was applied. Note that by failure, I mean in the context of run-webkit-tests. There is a way to get DRT to run the test in a fresh WebView *even* in the context of run-webkit-tests, and that is to run the test in a new window.
Jędrzej Nowacki
Comment 10 2010-05-26 06:52:40 PDT
Created attachment 57091 [details] layout test v2 (In reply to comment #8) > (From update of attachment 57020 [details]) > (...) But run-webkit-tests reuses the same WebView for a series of tests. Therefore - unless it goes first - this test won't actually excercise the buggy code path. Wow, I didn't know, it is evil :-). (In reply to comment #7) > If a layouttest was catching this case, then that layout test should've been failing. > If a layouttest was NOT catching this case, then adding one would not be redundant. I thought that bug was exposed after some other changes. For me document-destroyed-navigate-back-with-fragment-scroll.html is failing without the patch, but only when it is run as a first test, I haven't noticed ordering issue. It is why I wrote that a new test would be a bit redundant. (In reply to comment #9) > (...) There is a way to get DRT to run the test in a fresh WebView *even* in the context of run-webkit-tests, and that is to run the test in a new window. New patch use this trick. Shouldn't we fix DRT? The bug wasn't caught only because of this "feature", for example document-destroyed-navigate-back-with-fragment-scroll.html covers similar use case.
Darin Adler
Comment 11 2010-05-26 09:59:51 PDT
Running all the tests in the same WebView isn't a "trick", it's just how the tests are run, and it’s closer to the normal model of web browsing. Making a new WebView every time would both be slower and would hide other kinds of bugs. Most tests aren’t sensitively dependent on whether the WebView is new.
Brady Eidson
Comment 12 2010-05-26 10:04:18 PDT
Comment on attachment 57091 [details] layout test v2 As Darin mentioned, this isn't a bug in DRT, but a conscious decision. The type of test that relies on having a fresh WebView is actually quite the rare exception. Thanks for adding this test.
Jędrzej Nowacki
Comment 13 2010-05-27 00:38:34 PDT
Thank you for explaination and review.
WebKit Commit Bot
Comment 14 2010-05-27 05:48:57 PDT
Comment on attachment 57091 [details] layout test v2 Clearing flags on attachment: 57091 Committed r60295: <http://trac.webkit.org/changeset/60295>
WebKit Commit Bot
Comment 15 2010-05-27 05:49:05 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.