Summary: | window.location.hash's '#' get doubled | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Tim Landscheidt <tim> |
Component: | khtml | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | maksim |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Fedora RPMs | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Tim Landscheidt
2008-03-12 16:54:32 UTC
Thanks for the testcase.. Weird that is affects rendering... Yikes. The not showing bug is actually different --- it somehow stops parsing. Presumably one can avoid that by having hash-setting do gotoAnchor immediately, but it needs debugging.. OK, the sequence is this: 1) .href is set, Location::put calls goURL, with a full URL 2) goURL sees a full URL, not just #foo, and requests an immediate redirection from the part 3) KHTMLPart::executeScript notices the immediate redirection. It aborts the tokenizer, and starts a timeout-0 redirectionTimer 4) That calls urlSelected, which notices we're just going to the same page, and jumps to an anchor... My initial tendency would be to make goURL's fragment test smarter, making it sync'd with the one in KHTMLPart::urlSelected, but that seems suboptimal. I guess the tokenizer kill is needed to make sure no further scripts run, though. Related testcase: <HTML> <HEAD> <TITLE>Test</TITLE> <SCRIPT> window.location = "javascript:alert('hi')"; </SCRIPT> </HEAD> <BODY> <P ID="p1">Test 1</P> <P ID="p2">Test 2</P> <P ID="p3">Test 3</P> </BODY> </HTML> More fun: <SCRIPT> window.location = "javascript:alert('hi')"; window.location = "javascript:alert('cruel world')"; alert(window.location); </SCRIPT> I'm having problems with this bug under OpenSUSE 10.3, KDE 3.5.7. Here's a workaround hack for JavaScript: window.location.hash = hash; if ( window.location.hash != hash ) { window.location.assign( window.location.toString().replace( /#.*/, "" ) + hash ); } -- Steve -- Steve SVN commit 825638 by orlovich: Fix a number of issues related to redirections: - Strip leading # if given to location.hash, as other browsers do (part of #159192); avoids doubling it with various history frameworks, and stops confusing facebook's photo view (#165221) - Properly handle in-place redirects such as anchor jumps completely synchronously (part of #159192) - More importantly, don't handle in-place redirects as changing pages, which aborts parsing. Fixes some Wikipedia pages showing up blank. - Properly update history on anchor jumps, including honoring locking (#159279, #137176) Also, cleanup some of the handling of JavaScript URLs --- use the helpers I needed for above and not 10 different copies of string munging. BUG:165221 BUG:159192 BUG:159279 BUG:137176 M +14 -15 ecma/kjs_window.cpp M +72 -38 khtml_part.cpp M +23 -1 khtmlpart_p.h WebSVN link: http://websvn.kde.org/?view=rev&revision=825638 |