Bug 322734 - onhashchange is called before the actual hash change
Summary: onhashchange is called before the actual hash change
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: 4.10.5
Platform: FreeBSD Ports All
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL: http://jsfiddle.net/lapo/L9znw/3/embe...
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-23 12:40 UTC by Lapo Luchini
Modified: 2013-07-24 18:26 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 4.11.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lapo Luchini 2013-07-23 12:40:07 UTC
Using this example, clicking [1] then clicking [2], I get:

http://jsfiddle.net/lapo/L9znw/3/embedded/result/

hash=#1
e.oldURL=http://fiddle.jshell.net/lapo/L9znw/3/show/light/#1
e.newURL=http://fiddle.jshell.net/lapo/L9znw/3/show/light/#2
userAgent=Mozilla/5.0 (X11; FreeBSD amd64) KHTML/4.10.5 (like Gecko) Konqueror/4.10

While most other browser agree to have hash=#2 (the one just cliked), as per examples that follow.

I'm using location.hash instead of event.newURL because 1. it's already parsed (and I don't need to slice at the #) 2. IE doesn't have event.newURL. Of course this could be worked around, but still seems a nice idea to me to conform to what everyone else seems to agree upon.

hash=#2
e.oldURL=http://fiddle.jshell.net/lapo/L9znw/3/show/light/#1
e.newURL=http://fiddle.jshell.net/lapo/L9znw/3/show/light/#2
userAgent=Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36

hash=#2
e.oldURL=undefined
e.newURL=undefined
userAgent=Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)

hash=#2
e.oldURL=http://fiddle.jshell.net/lapo/L9znw/3/show/light/#1
e.newURL=http://fiddle.jshell.net/lapo/L9znw/3/show/light/#2
userAgent=Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0

hash=#2
e.oldURL=http://fiddle.jshell.net/lapo/L9znw/3/show/light/#1
e.newURL=http://fiddle.jshell.net/lapo/L9znw/3/show/light/#2
userAgent=Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.12

hash=#2
e.oldURL=http://fiddle.jshell.net/lapo/L9znw/3/show/light/#1
e.newURL=http://fiddle.jshell.net/lapo/L9znw/3/show/light/#2
userAgent=Mozilla/5.0 (X11; FreeBSD amd64; rv:22.0) Gecko/20100101 Firefox/22.0 SeaMonkey/2.19
Comment 1 Lapo Luchini 2013-07-23 15:41:16 UTC
Also (independently) seen on Konqueror 4.10.4 - Fedora 17.
Comment 2 Andrea Iacovitti 2013-07-23 20:18:34 UTC
Git commit 13f175d6cbc564ba25be0c7524b16f8cb87dc405 by Andrea Iacovitti.
Committed on 23/07/2013 at 20:10.
Pushed by aiacovitti into branch 'KDE/4.11'.

Set the new url for the part before emitting hashchange event.
FIXED-IN: 4.11.0

M  +7    -3    khtml/khtml_part.cpp

http://commits.kde.org/kdelibs/13f175d6cbc564ba25be0c7524b16f8cb87dc405
Comment 3 Lapo Luchini 2013-07-24 18:26:18 UTC
Andrea Iacovitti wrote:
> Git commit 13f175d6cbc564ba25be0c7524b16f8cb87dc405 by Andrea Iacovitti.
> Committed on 23/07/2013 at 20:10.
> Pushed by aiacovitti into branch 'KDE/4.11'.

Wow, mai bug fu risolto più in fretta! :)
(non tra quelli segnalati da me, almeno)

ciao,