Bug 94265

Summary: popstate is fired at the wrong time on load
Product: WebKit Reporter: Glenn Maynard <glenn>
Component: HistoryAssignee: Antoine Quint <graouts>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, aroben, beidson, buildbot, commit-queue, esprehn+autocc, graouts, kangil.han, nvbalaji.os, rniwa, sonny.piers, webkit-bug-importer, webkit
Priority: P2 Keywords: BlinkMergeCandidate, InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
test
none
Patch
none
Archive of layout-test-results from ews101 for mac-mavericks
none
Archive of layout-test-results from ews107 for mac-mavericks-wk2
none
Patch
none
Archive of layout-test-results from ews104 for mac-mavericks-wk2
none
Patch none

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.