Commit 7eba557c authored by Andrea Iacovitti's avatar Andrea Iacovitti

Do not add new entry in browser history when executing local anchor jump and...

Do not add new entry in browser history when executing local anchor jump and the hash part doesn't change.

BUG: 124328
parent b2198b67
......@@ -630,14 +630,18 @@ bool KHTMLPartPrivate::isLocalAnchorJump( const KUrl& url )
void KHTMLPartPrivate::executeAnchorJump( const KUrl& url, bool lockHistory )
{
// Note: we want to emit openUrlNotify first thing, to make the history capture the old state.
if (!lockHistory)
emit m_extension->openUrlNotify();
DOM::HashChangeEventImpl *hashChangeEvImpl = 0;
const QString &oldRef = q->url().ref();
const QString &newRef = url.ref();
if ((oldRef != newRef) || (oldRef.isNull() && newRef.isEmpty())) {
const bool hashChanged = (oldRef != newRef) || (oldRef.isNull() && newRef.isEmpty());
if (hashChanged) {
// Note: we want to emit openUrlNotify first thing to make the history capture the old state,
// however do not update history if a lock was explicitly requested, e.g. Location.replace()
if (!lockHistory) {
emit m_extension->openUrlNotify();
}
// Create hashchange event
hashChangeEvImpl = new DOM::HashChangeEventImpl();
hashChangeEvImpl->initHashChangeEvent("hashchange",
true, //bubble
......@@ -647,8 +651,8 @@ void KHTMLPartPrivate::executeAnchorJump( const KUrl& url, bool lockHistory )
);
}
if ( !q->gotoAnchor( url.encodedHtmlRef()) )
q->gotoAnchor( url.htmlRef() );
if (!q->gotoAnchor(newRef)) // encoded fragment
q->gotoAnchor(url.htmlRef()); // not encoded fragment
q->setUrl(url);
emit m_extension->setLocationBarUrl( url.prettyUrl() );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment