This seems like it is a bug in our implementation. The behavior (previously unspecified) is now spec in http://www.whatwg.org/specs/web-apps/current-work/#dom-history-length Please file a bug. Thanks, Sam On Mar 9, 2009, at 3:41 PM, Manuel Deschamps wrote: Hello guys, It is been while!.. I had a question for you about the History object. In IE and Firefox, history.length returns the number of elements in the history list while in Safari and Opera the same property returns the "index" of the page in the history list. Example: 1) launch browser X 2) go to www.apple.com 3) then go to www.yahoo.com 4) click the back button 5) type javascript:alert(history.length) in IE,FF the value is 2, in Safari 3/4 the value is 1 So my question is, is this a bug in Safari or IE and FF are not following the standard correctly? :) Thanks _________________________________________ Manuel Deschamps | Software Engineer - Yahoo! Mail tel: 408-336-0493 | manueldr@yahoo-inc.com
<rdar://problem/6670095>
Confirming. This is a bug per spec, and it seems like WebKit really should match IE and FF here. I'm happy to write a patch for this if there are no objections to changing WebKit's behavior.
No brainer. Do it.
Created attachment 46703 [details] v1 patch
Comment on attachment 46703 [details] v1 patch r+
Landed as http://trac.webkit.org/changeset/53346
Looks like this is failing on Leopard: http://build.webkit.org/results/Leopard%20Intel%20Release%20(Tests)/r53346%20(9430)/fast/history/history-length-pretty-diff.html I think you already mentioned that in IRC, but wanted to record it here in case you hadn't noticed.
Darin is not online or in his office. I'm going to roll out this change to fix the builders. He can roll it back in with the test fixed.
Darin disabled the test in http://trac.webkit.org/changeset/53348 so the builders should roll green.
*** Bug 14499 has been marked as a duplicate of this bug. ***
It doesn't look like the patch was rolled out, after all. And the test has been fixed, too. Does the bug need to remain open for some reason?
This bug should be updated with the revision of the fix, but certainly doesn't need to stay open on my account. :)
Yeah, I fixed the test. See https://bugs.webkit.org/show_bug.cgi?id=33749 for details.