зеркало из https://github.com/mozilla/pjs.git
Fixing bug 202636. Patch by psolanki@myrealbox.com. Adding document.referrer to all document types. r+sr=jst@mozilla.jstenback.com
This commit is contained in:
Родитель
1100669bd5
Коммит
b73f25bae6
|
@ -773,6 +773,7 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup)
|
|||
mContentType.Truncate();
|
||||
mContentLanguage.Truncate();
|
||||
mBaseTarget.Truncate();
|
||||
mReferrer.Truncate();
|
||||
|
||||
mXMLDeclarationBits = 0;
|
||||
}
|
||||
|
@ -925,6 +926,13 @@ nsDocument::SetContentType(const nsAString& aContentType)
|
|||
CopyUTF16toUTF8(aContentType, mContentType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetReferrer(nsAString& aReferrer)
|
||||
{
|
||||
CopyUTF8toUTF16(mReferrer, aReferrer);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDocument::SetBaseURI(nsIURI* aURI)
|
||||
{
|
||||
|
@ -4093,6 +4101,13 @@ nsDocument::RetrieveRelevantHeaders(nsIChannel *aChannel)
|
|||
mLastModified.Truncate();
|
||||
}
|
||||
|
||||
// The misspelled key 'referer' is as per the HTTP spec
|
||||
rv = httpChannel->GetRequestHeader(NS_LITERAL_CSTRING("referer"),
|
||||
mReferrer);
|
||||
if (NS_FAILED(rv)) {
|
||||
mReferrer.Truncate();
|
||||
}
|
||||
|
||||
rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Language"),
|
||||
mContentLanguage);
|
||||
|
||||
|
|
|
@ -512,6 +512,7 @@ protected:
|
|||
nsDocument();
|
||||
virtual ~nsDocument();
|
||||
|
||||
nsCString mReferrer;
|
||||
nsCString mLastModified;
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
|
||||
|
|
|
@ -712,29 +712,6 @@ nsHTMLDocument::StartAutodetection(nsIDocShell *aDocShell, nsACString& aCharset,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLDocument::RetrieveRelevantHeaders(nsIChannel *aChannel)
|
||||
{
|
||||
mChannel = aChannel;
|
||||
mHttpChannel = do_QueryInterface(aChannel);
|
||||
|
||||
nsDocument::RetrieveRelevantHeaders(aChannel);
|
||||
|
||||
if (mHttpChannel) {
|
||||
nsCAutoString header;
|
||||
nsresult rv;
|
||||
|
||||
// The misspelled key 'referer' is as per the HTTP spec
|
||||
rv = mHttpChannel->GetRequestHeader(NS_LITERAL_CSTRING("referer"),
|
||||
header);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
SetReferrer(NS_ConvertASCIItoUCS2(header));
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
nsIChannel* aChannel,
|
||||
|
@ -1198,14 +1175,6 @@ nsHTMLDocument::InternalGetNumberOfStyleSheets() const
|
|||
return count;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::SetReferrer(const nsAString& aReferrer)
|
||||
{
|
||||
mReferrer.Assign(aReferrer);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsICSSLoader*
|
||||
nsHTMLDocument::GetCSSLoader()
|
||||
{
|
||||
|
@ -1805,9 +1774,7 @@ nsHTMLDocument::GetTitle(nsAString& aTitle)
|
|||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetReferrer(nsAString& aReferrer)
|
||||
{
|
||||
aReferrer.Assign(mReferrer);
|
||||
|
||||
return NS_OK;
|
||||
return nsDocument::GetReferrer(aReferrer);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -113,8 +113,6 @@ public:
|
|||
|
||||
virtual nsICSSLoader* GetCSSLoader();
|
||||
|
||||
NS_IMETHOD SetReferrer(const nsAString& aReferrer);
|
||||
|
||||
NS_IMETHOD GetCompatibilityMode(nsCompatibility& aMode);
|
||||
NS_IMETHOD SetCompatibilityMode(nsCompatibility aMode);
|
||||
|
||||
|
@ -256,10 +254,6 @@ protected:
|
|||
nsresult CreateAndAddWyciwygChannel(void);
|
||||
nsresult RemoveWyciwygChannel(void);
|
||||
|
||||
virtual void RetrieveRelevantHeaders(nsIChannel *aChannel);
|
||||
|
||||
nsString mReferrer;
|
||||
|
||||
nsCOMPtr<nsIChannel> mChannel;
|
||||
nsCOMPtr<nsIHttpChannel> mHttpChannel;
|
||||
|
||||
|
|
|
@ -72,8 +72,6 @@ public:
|
|||
|
||||
NS_IMETHOD RemoveImageMap(nsIDOMHTMLMapElement* aMap) = 0;
|
||||
|
||||
NS_IMETHOD SetReferrer(const nsAString& aReferrer) = 0;
|
||||
|
||||
/**
|
||||
* Access compatibility mode for this document
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче