Bug 1602483 part 1. Add a window id argument to SetupRefreshURIFromHeader. r=ckerschb

We can use this for error reporting.

Differential Revision: https://phabricator.services.mozilla.com/D56427

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-12-12 13:03:56 +00:00
Родитель 2dd81d3884
Коммит 1910b91cdf
4 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -5468,6 +5468,7 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
nsresult nsDocShell::SetupRefreshURIFromHeader(nsIURI* aBaseURI,
nsIPrincipal* aPrincipal,
uint64_t aInnerWindowID,
const nsACString& aHeader) {
// Refresh headers are parsed with the following format in mind
// <META HTTP-EQUIV=REFRESH CONTENT="5; URL=http://uri">
@ -5722,7 +5723,9 @@ nsDocShell::SetupRefreshURI(nsIChannel* aChannel) {
NS_ENSURE_SUCCESS(rv, rv);
SetupReferrerInfoFromChannel(aChannel);
rv = SetupRefreshURIFromHeader(mCurrentURI, principal, refreshHeader);
// We have no idea what window id to use for error reporting
// here, so just pass 0.
rv = SetupRefreshURIFromHeader(mCurrentURI, principal, 0, refreshHeader);
if (NS_SUCCEEDED(rv)) {
return NS_REFRESHURI_HEADER_FOUND;
}

Просмотреть файл

@ -68,10 +68,12 @@ interface nsIRefreshURI : nsISupports {
* @param aPrincipal The triggeringPrincipal for the refresh load
* May be null, in which case the principal of current document will be
* applied.
* @param aInnerWindowID The window id to use for error reporting.
* @param aHeader The meta refresh header string.
*/
void setupRefreshURIFromHeader(in nsIURI aBaseURI,
in nsIPrincipal principal,
in unsigned long long aInnerWindowID,
in ACString aHeader);
/**

Просмотреть файл

@ -5879,6 +5879,7 @@ void Document::SetHeaderData(nsAtom* aHeaderField, const nsAString& aData) {
// before the current URI of the webnavigation has been updated, so we
// can't assert equality here.
refresher->SetupRefreshURIFromHeader(mDocumentURI, NodePrincipal(),
InnerWindowID(),
NS_ConvertUTF16toUTF8(aData));
}
}

Просмотреть файл

@ -219,9 +219,9 @@ nsresult txMozillaXMLOutput::endDocument(nsresult aResult) {
if (win) {
nsCOMPtr<nsIRefreshURI> refURI = do_QueryInterface(win->GetDocShell());
if (refURI) {
refURI->SetupRefreshURIFromHeader(mDocument->GetDocBaseURI(),
mDocument->NodePrincipal(),
mRefreshString);
refURI->SetupRefreshURIFromHeader(
mDocument->GetDocBaseURI(), mDocument->NodePrincipal(),
mDocument->InnerWindowID(), mRefreshString);
}
}
}