mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 654399. Try to make sure we always hand out the same exact string buffer each time location.hash is gotten. r=roc
This commit is contained in:
parent
94c9744ce2
commit
af0f5c831a
@ -1140,6 +1140,7 @@ protected:
|
||||
|
||||
nsresult CheckURL(nsIURI *url, nsIDocShellLoadInfo** aLoadInfo);
|
||||
|
||||
nsString mCachedHash;
|
||||
nsWeakPtr mDocShell;
|
||||
};
|
||||
|
||||
|
@ -405,6 +405,15 @@ nsLocation::GetHash(nsAString& aHash)
|
||||
aHash.Assign(PRUnichar('#'));
|
||||
aHash.Append(unicodeRef);
|
||||
}
|
||||
|
||||
if (aHash == mCachedHash) {
|
||||
// Work around ShareThis stupidly polling location.hash every
|
||||
// 5ms all the time by handing out the same exact string buffer
|
||||
// we handed out last time.
|
||||
aHash = mCachedHash;
|
||||
} else {
|
||||
mCachedHash = aHash;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
Loading…
Reference in New Issue
Block a user