Bug 94265 - popstate is fired at the wrong time on load
Summary: popstate is fired at the wrong time on load
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: History (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antoine Quint
URL:
Keywords: BlinkMergeCandidate, InRadar
Depends on:
Blocks:
 
Reported: 2012-08-16 16:34 PDT by Glenn Maynard
Modified: 2015-10-02 08:13 PDT (History)
13 users (show)

See Also:


Attachments
test (102 bytes, text/html)
2012-08-16 16:34 PDT, Glenn Maynard
no flags Details
Patch (28.30 KB, patch)
2015-10-01 07:29 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews101 for mac-mavericks (603.46 KB, application/zip)
2015-10-01 08:18 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews107 for mac-mavericks-wk2 (719.39 KB, application/zip)
2015-10-01 08:26 PDT, Build Bot
no flags Details
Patch (29.12 KB, patch)
2015-10-01 08:34 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews104 for mac-mavericks-wk2 (671.62 KB, application/zip)
2015-10-01 09:13 PDT, Build Bot
no flags Details
Patch (30.78 KB, patch)
2015-10-02 04:44 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Glenn Maynard 2012-08-16 16:34:44 PDT
Created attachment 158938 [details]
test

When loading a page, the following should not alert:

<!doctype html><script>window.onpopstate = function(event) { alert("onpopstate"); }</script>

because the spec path that leads to the event being fired (http://www.whatwg.org/specs/web-apps/current-work/#read-html "update the session history with the new page") happens before any script execution, so when it's fired, window.onpopstate has not been set yet.  Firefox doesn't alert.

It's less clear to me whether <body onpopstate="alert('test')"> should alert.  I don't think it's intended to, but I have an open question about this (http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-August/036926.html).
Comment 1 sonny.piers@gmail.com 2012-08-31 04:20:23 PDT
See also: https://code.google.com/p/chromium/issues/detail?id=63040
Comment 2 DJ Mountney 2014-01-16 11:10:28 PST
One of the Opera devs has now fixed it in blink:
https://src.chromium.org/viewvc/blink?revision=165221&view=revision
Comment 3 Radar WebKit Bug Importer 2015-10-01 04:18:01 PDT
<rdar://problem/22931046>
Comment 4 Antoine Quint 2015-10-01 07:29:02 PDT
Created attachment 262250 [details]
Patch
Comment 5 Build Bot 2015-10-01 08:18:34 PDT
Comment on attachment 262250 [details]
Patch

Attachment 262250 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/232669

New failing tests:
fast/loader/javascript-url-iframe-remove-on-navigate.html
Comment 6 Build Bot 2015-10-01 08:18:38 PDT
Created attachment 262252 [details]
Archive of layout-test-results from ews101 for mac-mavericks

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-mavericks  Platform: Mac OS X 10.9.5
Comment 7 Build Bot 2015-10-01 08:26:25 PDT
Comment on attachment 262250 [details]
Patch

Attachment 262250 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/232677

New failing tests:
fast/loader/javascript-url-iframe-remove-on-navigate.html
Comment 8 Build Bot 2015-10-01 08:26:28 PDT
Created attachment 262253 [details]
Archive of layout-test-results from ews107 for mac-mavericks-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-mavericks-wk2  Platform: Mac OS X 10.9.5
Comment 9 Antoine Quint 2015-10-01 08:34:43 PDT
Created attachment 262254 [details]
Patch
Comment 10 Build Bot 2015-10-01 09:12:53 PDT
Comment on attachment 262254 [details]
Patch

Attachment 262254 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/232805

New failing tests:
fast/loader/stateobjects/pushstate-object-types.html
Comment 11 Build Bot 2015-10-01 09:13:03 PDT
Created attachment 262258 [details]
Archive of layout-test-results from ews104 for mac-mavericks-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-mavericks-wk2  Platform: Mac OS X 10.9.5
Comment 12 Antoine Quint 2015-10-02 04:44:51 PDT
Created attachment 262327 [details]
Patch
Comment 13 WebKit Commit Bot 2015-10-02 08:13:34 PDT
Comment on attachment 262327 [details]
Patch

Clearing flags on attachment: 262327

Committed r190505: <http://trac.webkit.org/changeset/190505>
Comment 14 WebKit Commit Bot 2015-10-02 08:13:43 PDT
All reviewed patches have been landed.  Closing bug.