diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 879987e1777..c3a15372fb3 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -2358,6 +2358,26 @@ nsDocShell::GetSessionHistory(nsISHistory ** aSessionHistory) } +NS_IMETHODIMP +nsDocShell::GetPostData(nsIInputStream **aPostStream) +{ + NS_ENSURE_ARG_POINTER(aPostStream); + + if (mLSHE) { + mLSHE->GetPostData(aPostStream); + } + else if (mOSHE) { + mOSHE->GetPostData(aPostStream); + } + else { + // XXX: If session history is disabled, then there is no way to + // get the post data :-( + *aPostStream = nsnull; + } + + return NS_OK; +} + //***************************************************************************** // nsDocShell::nsIBaseWindow //***************************************************************************** diff --git a/mozilla/docshell/base/nsIWebNavigation.idl b/mozilla/docshell/base/nsIWebNavigation.idl index 81d23d1b24e..2586955b155 100644 --- a/mozilla/docshell/base/nsIWebNavigation.idl +++ b/mozilla/docshell/base/nsIWebNavigation.idl @@ -23,7 +23,7 @@ #include "nsISupports.idl" interface nsIDOMDocument; - +interface nsIInputStream; /** * The nsIWebNavigation interface defines an interface for navigating the web. @@ -127,6 +127,18 @@ interface nsIWebNavigation : nsISupports The current URI that is loaded. */ readonly attribute nsIURI currentURI; + + /** + * This input stream contains the post data associated with a HTTP POST + * request... + * It is also assumed that the stream supports the nsIRandomAccessStore + * interface. This allows the stream to be "rewound" back to the beginning + * of the data in the case of a reload. + * + * If this attribute is nsnull, then it is assumed that the current document + * is not the result of a HTTP POST request. + */ + readonly attribute nsIInputStream postData; /* The session history object used to store the session history for the session. diff --git a/mozilla/embedding/browser/webBrowser/nsWebBrowser.cpp b/mozilla/embedding/browser/webBrowser/nsWebBrowser.cpp index 7e64a304b88..24cb20d1298 100644 --- a/mozilla/embedding/browser/webBrowser/nsWebBrowser.cpp +++ b/mozilla/embedding/browser/webBrowser/nsWebBrowser.cpp @@ -619,6 +619,14 @@ NS_IMETHODIMP nsWebBrowser::GetDocument(nsIDOMDocument** aDocument) return mDocShellAsNav->GetDocument(aDocument); } +NS_IMETHODIMP +nsWebBrowser::GetPostData(nsIInputStream** aPostStream) +{ + NS_ENSURE_ARG_POINTER(aPostStream); + NS_ENSURE_STATE(mDocShell); + + return mDocShellAsNav->GetPostData(aPostStream); +} //***************************************************************************** // nsWebBrowser::nsIWebBrowserSetup diff --git a/mozilla/xpfe/components/shistory/src/nsSHistory.cpp b/mozilla/xpfe/components/shistory/src/nsSHistory.cpp index bb316283616..b53ad4fbaf4 100644 --- a/mozilla/xpfe/components/shistory/src/nsSHistory.cpp +++ b/mozilla/xpfe/components/shistory/src/nsSHistory.cpp @@ -546,6 +546,25 @@ nsSHistory::SetSessionHistory(nsISHistory* aSessionHistory) return NS_OK; } + +NS_IMETHODIMP +nsSHistory::GetPostData(nsIInputStream** aPostStream) +{ + nsresult rv; + nsCOMPtr currentEntry; + + NS_ENSURE_ARG_POINTER(aPostStream); + + *aPostStream = nsnull; + rv = GetEntryAtIndex(mIndex, PR_FALSE, getter_AddRefs(currentEntry)); + + if (currentEntry) { + rv = currentEntry->GetPostData(aPostStream); + } + + return rv; +} + NS_IMETHODIMP nsSHistory::GetSessionHistory(nsISHistory** aSessionHistory)