diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index c9e46b40a56..146a879e1dd 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -1140,6 +1140,7 @@ protected: nsresult CheckURL(nsIURI *url, nsIDocShellLoadInfo** aLoadInfo); + nsString mCachedHash; nsWeakPtr mDocShell; }; diff --git a/dom/base/nsLocation.cpp b/dom/base/nsLocation.cpp index 86510c82e87..b1b5560f60e 100644 --- a/dom/base/nsLocation.cpp +++ b/dom/base/nsLocation.cpp @@ -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;