mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Fix for bug #s 28758, 29609. When loading a url over and over again, it is added
to SH each time there by causing multiple entries for that url in go menu. r=law
This commit is contained in:
parent
d44a7da8ab
commit
7bf54b8cf1
@ -1730,6 +1730,26 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
|
||||
*/
|
||||
SetHistoryState(aHistoryState);
|
||||
|
||||
/* If the current Uri is the same as the one to be loaded
|
||||
* don't add it to session history. This avoids multiple
|
||||
* entries for the same url in the go menu
|
||||
*/
|
||||
nsCOMPtr<nsIURI> currentURI;
|
||||
nsresult res = GetCurrentURI(getter_AddRefs(currentURI));
|
||||
if (NS_SUCCEEDED(res) && currentURI) {
|
||||
nsXPIDLCString currentUriSpec;
|
||||
rv = currentURI->GetSpec(getter_Copies(currentUriSpec));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsAutoString currentURIString(currentUriSpec);
|
||||
if (currentURIString == spec) {
|
||||
/* The url to be loaded is the same as the
|
||||
* url already in the page. Don't add it to session history
|
||||
*/
|
||||
aModifyHistory = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Add the page to session history */
|
||||
if (aModifyHistory && shist && (!isMail)) {
|
||||
PRInt32 ret;
|
||||
@ -1738,13 +1758,13 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWebShell> parent;
|
||||
nsresult res = GetParent(*getter_AddRefs(parent));
|
||||
res = GetParent(*getter_AddRefs(parent));
|
||||
nsCOMPtr<nsIURI> newURI;
|
||||
|
||||
if ((isLoadingHistory)) {
|
||||
/* if LoadURL() got called from SH, AND If we are going "Back/Forward"
|
||||
* to a frame page,SH will change the current uri to the right value
|
||||
* for smoother redraw.
|
||||
* for smoother redraw.
|
||||
*/
|
||||
res = GetCurrentURI(getter_AddRefs(newURI));
|
||||
}
|
||||
|
@ -1730,6 +1730,26 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
|
||||
*/
|
||||
SetHistoryState(aHistoryState);
|
||||
|
||||
/* If the current Uri is the same as the one to be loaded
|
||||
* don't add it to session history. This avoids multiple
|
||||
* entries for the same url in the go menu
|
||||
*/
|
||||
nsCOMPtr<nsIURI> currentURI;
|
||||
nsresult res = GetCurrentURI(getter_AddRefs(currentURI));
|
||||
if (NS_SUCCEEDED(res) && currentURI) {
|
||||
nsXPIDLCString currentUriSpec;
|
||||
rv = currentURI->GetSpec(getter_Copies(currentUriSpec));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsAutoString currentURIString(currentUriSpec);
|
||||
if (currentURIString == spec) {
|
||||
/* The url to be loaded is the same as the
|
||||
* url already in the page. Don't add it to session history
|
||||
*/
|
||||
aModifyHistory = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Add the page to session history */
|
||||
if (aModifyHistory && shist && (!isMail)) {
|
||||
PRInt32 ret;
|
||||
@ -1738,13 +1758,13 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWebShell> parent;
|
||||
nsresult res = GetParent(*getter_AddRefs(parent));
|
||||
res = GetParent(*getter_AddRefs(parent));
|
||||
nsCOMPtr<nsIURI> newURI;
|
||||
|
||||
if ((isLoadingHistory)) {
|
||||
/* if LoadURL() got called from SH, AND If we are going "Back/Forward"
|
||||
* to a frame page,SH will change the current uri to the right value
|
||||
* for smoother redraw.
|
||||
* for smoother redraw.
|
||||
*/
|
||||
res = GetCurrentURI(getter_AddRefs(newURI));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user