From 55ee92803da17cf51ef66f88263136d525628f72 Mon Sep 17 00:00:00 2001 From: "sdwilsh%shawnwilsher.com" Date: Wed, 6 Feb 2008 18:18:07 +0000 Subject: [PATCH] Bug 94514 - POST result page should not appear in global history or history autocomplete results. r=bz, sr=bz git-svn-id: svn://10.0.0.236/trunk@245011 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 10 +++ mozilla/docshell/test/Makefile.in | 2 + mozilla/docshell/test/bug94514-postpage.html | 30 +++++++++ mozilla/docshell/test/test_bug94514.html | 64 ++++++++++++++++++++ 4 files changed, 106 insertions(+) create mode 100644 mozilla/docshell/test/bug94514-postpage.html create mode 100644 mozilla/docshell/test/test_bug94514.html diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 88c669586c5..d26ac8edbec 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -8612,6 +8612,16 @@ nsDocShell::AddToGlobalHistory(nsIURI * aURI, PRBool aRedirect, if (mItemType != typeContent || !mGlobalHistory) return NS_OK; + // If this is a POST request, we do not want to include this in global + // history, so return early. + nsCOMPtr hchan(do_QueryInterface(aChannel)); + if (hchan) { + nsCAutoString type; + nsresult rv = hchan->GetRequestMethod(type); + if (NS_SUCCEEDED(rv) && type.EqualsLiteral("POST")) + return NS_OK; + } + PRBool visited; nsresult rv = mGlobalHistory->IsVisited(aURI, &visited); if (NS_FAILED(rv)) diff --git a/mozilla/docshell/test/Makefile.in b/mozilla/docshell/test/Makefile.in index c4fbb9b6f8b..dcc9b844ebf 100644 --- a/mozilla/docshell/test/Makefile.in +++ b/mozilla/docshell/test/Makefile.in @@ -54,6 +54,8 @@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk _TEST_FILES = \ + test_bug94514.html \ + bug94514-postpage.html \ test_bug344861.html \ test_bug369814.html \ bug369814.zip \ diff --git a/mozilla/docshell/test/bug94514-postpage.html b/mozilla/docshell/test/bug94514-postpage.html new file mode 100644 index 00000000000..cbbaf638a35 --- /dev/null +++ b/mozilla/docshell/test/bug94514-postpage.html @@ -0,0 +1,30 @@ + + + + + Test Page for Bug 94515 + + + +
+ +
+ + + + diff --git a/mozilla/docshell/test/test_bug94514.html b/mozilla/docshell/test/test_bug94514.html new file mode 100644 index 00000000000..250a859b822 --- /dev/null +++ b/mozilla/docshell/test/test_bug94514.html @@ -0,0 +1,64 @@ + + + + + Test for Bug 94515 + + + + + + +Mozilla Bug 94514 + + +
+
+
+ +