diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index 54ecc620d18..1839bc85ebf 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -665,9 +665,11 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, if(NS_SUCCEEDED(result)) { // We do this to help consumers who don't have access to the webshell. - nsAutoString theID; - theID.AssignWithConversion("docshell"); - parserBundle->SetDataIntoBundle(theID,docShell); + nsAutoString theDocShell,theChannel; + theDocShell.AssignWithConversion("docshell"); + theChannel.AssignWithConversion("channel"); + parserBundle->SetDataIntoBundle(theDocShell,docShell); + parserBundle->SetDataIntoBundle(theChannel,aChannel); } } diff --git a/mozilla/htmlparser/src/nsParser.cpp b/mozilla/htmlparser/src/nsParser.cpp index e60264c3346..7cb349ed20d 100644 --- a/mozilla/htmlparser/src/nsParser.cpp +++ b/mozilla/htmlparser/src/nsParser.cpp @@ -2411,7 +2411,7 @@ nsresult nsParser::OnStopRequest(nsIChannel* channel, nsISupports* aContext, gOutFile=0; } #endif - + NS_IF_RELEASE(mBundle); return result; } diff --git a/mozilla/intl/chardet/src/nsObserverBase.cpp b/mozilla/intl/chardet/src/nsObserverBase.cpp index febca797370..a876765b17e 100644 --- a/mozilla/intl/chardet/src/nsObserverBase.cpp +++ b/mozilla/intl/chardet/src/nsObserverBase.cpp @@ -31,6 +31,7 @@ #include "nsIParser.h" #include "nsString.h" #include "nsIDocShell.h" +#include "nsIHTTPChannel.h" static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -45,17 +46,37 @@ NS_IMETHODIMP nsObserverBase::NotifyWebShell( nsresult rv = NS_OK; - nsAutoString theKey; - - theKey.AssignWithConversion("docshell"); // Key to find docshell from the bundle. - nsCOMPtr bundle=do_QueryInterface(aParserBundle); if (bundle) { - nsCOMPtr docshell=nsnull; nsresult res = NS_OK; + + // XXX - Make sure not to reload POST data to prevent bugs such as 27006 + nsAutoString theChannelKey; + theChannelKey.AssignWithConversion("channel"); + + nsCOMPtr channel=nsnull; + res=bundle->GetDataFromBundle(theChannelKey,getter_AddRefs(channel)); + if(NS_SUCCEEDED(res)) { + nsCOMPtr httpChannel(do_QueryInterface(channel,&res)); + if(NS_SUCCEEDED(res)) { + nsIAtom* atom=nsnull; + httpChannel->GetRequestMethod(&atom); + if(atom) { + nsAutoString method; + atom->ToString(method); + if(method.EqualsWithConversion("POST")) + return NS_OK; + } + } + } + + nsAutoString theDocShellKey; + theDocShellKey.AssignWithConversion("docshell"); // Key to find docshell from the bundle. + + nsCOMPtr docshell=nsnull; - res=bundle->GetDataFromBundle(theKey,getter_AddRefs(docshell)); + res=bundle->GetDataFromBundle(theDocShellKey,getter_AddRefs(docshell)); if(NS_SUCCEEDED(res)) { nsCOMPtr wss=nsnull; wss=do_QueryInterface(docshell,&res); // Query webshell service through docshell. diff --git a/mozilla/layout/html/document/src/nsHTMLDocument.cpp b/mozilla/layout/html/document/src/nsHTMLDocument.cpp index 54ecc620d18..1839bc85ebf 100644 --- a/mozilla/layout/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/layout/html/document/src/nsHTMLDocument.cpp @@ -665,9 +665,11 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, if(NS_SUCCEEDED(result)) { // We do this to help consumers who don't have access to the webshell. - nsAutoString theID; - theID.AssignWithConversion("docshell"); - parserBundle->SetDataIntoBundle(theID,docShell); + nsAutoString theDocShell,theChannel; + theDocShell.AssignWithConversion("docshell"); + theChannel.AssignWithConversion("channel"); + parserBundle->SetDataIntoBundle(theDocShell,docShell); + parserBundle->SetDataIntoBundle(theChannel,aChannel); } } diff --git a/mozilla/parser/htmlparser/src/nsParser.cpp b/mozilla/parser/htmlparser/src/nsParser.cpp index e60264c3346..7cb349ed20d 100644 --- a/mozilla/parser/htmlparser/src/nsParser.cpp +++ b/mozilla/parser/htmlparser/src/nsParser.cpp @@ -2411,7 +2411,7 @@ nsresult nsParser::OnStopRequest(nsIChannel* channel, nsISupports* aContext, gOutFile=0; } #endif - + NS_IF_RELEASE(mBundle); return result; }