Bug 67732

Summary: [Chromium] Web Inspector: Bug with console.log and popstate/hashchange events
Product: WebKit Reporter: Zach Leatherman <zachleatherman>
Component: HistoryAssignee: Yury Semikhatsky <yurys>
Status: RESOLVED FIXED    
Severity: Minor CC: apavlov, bweinstein, eric, fishd, joepeck, keishi, loislo, pfeldman, pmuellr, rik, timothy, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows XP   
URL: http://jsbin.com/owuyel
Attachments:
Description Flags
Global i holds the number of times popstate has fired.
none
Reduced test case
none
Patch pfeldman: review+

Description Zach Leatherman 2011-09-07 14:12:00 PDT
Created attachment 106634 [details]
Global i holds the number of times popstate has fired.

If I bind a simple event handler to the popstate event with a console.log, it will execute the console.log multiple times per onpopstate event.  The onpopstate event fires only once, it just triggers console.log multiple times.

Looks like the same for hashchange.

Chrome 14.0.835.157 beta-m
Comment 1 Eric Seidel (no email) 2011-09-26 17:05:48 PDT
I'm told Darin is mr. popstate (but I could be misinformed).
Comment 2 Eric Seidel (no email) 2011-09-26 17:06:40 PDT
I see.  So this isn't a popstate bug, this is an interaction with the web inspector?

In which case, Pavel is your man.
Comment 3 Yury Semikhatsky 2011-09-27 00:35:14 PDT
Looks like a bug in web inspector. After navigation two original messages are printed before the actual PopStateEvent.
Comment 4 Yury Semikhatsky 2011-09-27 02:19:38 PDT
Created attachment 108817 [details]
Reduced test case

This is a Chromium-specific issue. The problem here is that when back button is pushed we receive OnNavigatingToPendingEntry in the browser and send Detach followed by Attach to the corresponding DevToolsAgent to make sure our front-end is connected to correct RenderViewHost. In case of navigation back to the same URL with a different fragment we probably shouldn't do this as RVH doesn't change in that case.
Comment 5 Yury Semikhatsky 2011-09-27 05:09:28 PDT
Filed Chromium bug: http://code.google.com/p/chromium/issues/detail?id=98210
Comment 6 Yury Semikhatsky 2011-09-27 05:11:47 PDT
Created attachment 108827 [details]
Patch
Comment 7 Yury Semikhatsky 2011-09-27 05:39:28 PDT
Committed r96100: <http://trac.webkit.org/changeset/96100>
Comment 8 Yury Semikhatsky 2011-09-27 05:40:57 PDT
Chromium patch will be landed after WebKit r96100 is rolled.