Backed out 5 changesets (bug 1742865, bug 1744397) for causing wpt failures on attr-meta-http-equiv-refresh/parsing.html CLOSED TREE
Backed out changeset 7b01edc5a0e0 (bug 1744397) Backed out changeset 41abd4b7d2c0 (bug 1744397) Backed out changeset 634641e3a05a (bug 1744397) Backed out changeset 6e7755177481 (bug 1744397) Backed out changeset e9fc94b33da9 (bug 1742865)
This commit is contained in:
@@ -20,7 +20,6 @@
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/Casting.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/Components.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
@@ -5011,8 +5010,8 @@ void nsDocShell::SetScrollbarPreference(mozilla::ScrollbarPreference aPref) {
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::RefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
|
||||
uint32_t aDelay) {
|
||||
nsDocShell::RefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal, int32_t aDelay,
|
||||
bool aRepeat, bool aMetaRefresh) {
|
||||
MOZ_ASSERT(!mIsBeingDestroyed);
|
||||
|
||||
NS_ENSURE_ARG(aURI);
|
||||
@@ -5041,7 +5040,7 @@ nsDocShell::RefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITimerCallback> refreshTimer =
|
||||
new nsRefreshTimer(this, aURI, aPrincipal, aDelay);
|
||||
new nsRefreshTimer(this, aURI, aPrincipal, aDelay, aRepeat, aMetaRefresh);
|
||||
|
||||
BusyFlags busyFlags = GetBusyFlags();
|
||||
|
||||
@@ -5072,7 +5071,7 @@ nsDocShell::RefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
|
||||
|
||||
nsresult nsDocShell::ForceRefreshURIFromTimer(nsIURI* aURI,
|
||||
nsIPrincipal* aPrincipal,
|
||||
uint32_t aDelay,
|
||||
int32_t aDelay, bool aMetaRefresh,
|
||||
nsITimer* aTimer) {
|
||||
MOZ_ASSERT(aTimer, "Must have a timer here");
|
||||
|
||||
@@ -5090,12 +5089,12 @@ nsresult nsDocShell::ForceRefreshURIFromTimer(nsIURI* aURI,
|
||||
}
|
||||
}
|
||||
|
||||
return ForceRefreshURI(aURI, aPrincipal, aDelay);
|
||||
return ForceRefreshURI(aURI, aPrincipal, aDelay, aMetaRefresh);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
|
||||
uint32_t aDelay) {
|
||||
int32_t aDelay, bool aMetaRefresh) {
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState(aURI);
|
||||
@@ -5103,7 +5102,7 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
|
||||
loadState->SetResultPrincipalURI(aURI);
|
||||
loadState->SetResultPrincipalURIIsSome(true);
|
||||
loadState->SetKeepResultPrincipalURIIfSet(true);
|
||||
loadState->SetIsMetaRefresh(true);
|
||||
loadState->SetIsMetaRefresh(aMetaRefresh);
|
||||
|
||||
// Set the triggering pricipal to aPrincipal if available, or current
|
||||
// document's principal otherwise.
|
||||
@@ -5132,7 +5131,8 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
|
||||
nsresult rv = aURI->Equals(mCurrentURI, &equalUri);
|
||||
|
||||
nsCOMPtr<nsIReferrerInfo> referrerInfo;
|
||||
if (NS_SUCCEEDED(rv) && !equalUri && aDelay <= REFRESH_REDIRECT_TIMER) {
|
||||
if (NS_SUCCEEDED(rv) && (!equalUri) && aMetaRefresh &&
|
||||
aDelay <= REFRESH_REDIRECT_TIMER) {
|
||||
/* It is a META refresh based redirection within the threshold time
|
||||
* we have in mind (15000 ms as defined by REFRESH_REDIRECT_TIMER).
|
||||
* Pass a REPLACE flag to LoadURI().
|
||||
@@ -5221,7 +5221,7 @@ nsresult nsDocShell::SetupRefreshURIFromHeader(nsIURI* aBaseURI,
|
||||
MOZ_ASSERT(aPrincipal);
|
||||
|
||||
nsAutoCString uriAttrib;
|
||||
CheckedInt<uint32_t> seconds(0);
|
||||
int32_t seconds = 0;
|
||||
bool specifiesSeconds = false;
|
||||
|
||||
nsACString::const_iterator iter, tokenStart, doneIterating;
|
||||
@@ -5236,33 +5236,24 @@ nsresult nsDocShell::SetupRefreshURIFromHeader(nsIURI* aBaseURI,
|
||||
|
||||
tokenStart = iter;
|
||||
|
||||
if (iter != doneIterating) {
|
||||
if (*iter == '-') {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// skip leading +
|
||||
if (*iter == '+') {
|
||||
++iter;
|
||||
}
|
||||
// skip leading + and -
|
||||
if (iter != doneIterating && (*iter == '-' || *iter == '+')) {
|
||||
++iter;
|
||||
}
|
||||
|
||||
// parse number
|
||||
while (iter != doneIterating && (*iter >= '0' && *iter <= '9')) {
|
||||
seconds = seconds * 10 + (*iter - '0');
|
||||
if (!seconds.isValid()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
specifiesSeconds = true;
|
||||
++iter;
|
||||
}
|
||||
|
||||
CheckedInt<uint32_t> milliSeconds(seconds * 1000);
|
||||
if (!milliSeconds.isValid()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (iter != doneIterating) {
|
||||
// if we started with a '-', number is negative
|
||||
if (*tokenStart == '-') {
|
||||
seconds = -seconds;
|
||||
}
|
||||
|
||||
// skip to next ';' or ','
|
||||
nsACString::const_iterator iterAfterDigit = iter;
|
||||
while (iter != doneIterating && !(*iter == ';' || *iter == ',')) {
|
||||
@@ -5408,7 +5399,45 @@ nsresult nsDocShell::SetupRefreshURIFromHeader(nsIURI* aBaseURI,
|
||||
}
|
||||
}
|
||||
|
||||
rv = RefreshURI(uri, aPrincipal, milliSeconds.value());
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Since we can't travel back in time yet, just pretend
|
||||
// negative numbers do nothing at all.
|
||||
if (seconds < 0) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
rv = RefreshURI(uri, aPrincipal, seconds * 1000, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetupRefreshURI(nsIChannel* aChannel) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(aChannel, &rv));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoCString refreshHeader;
|
||||
rv = httpChannel->GetResponseHeader("refresh"_ns, refreshHeader);
|
||||
|
||||
if (!refreshHeader.IsEmpty()) {
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan =
|
||||
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
rv = secMan->GetChannelResultPrincipal(aChannel,
|
||||
getter_AddRefs(principal));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
SetupReferrerInfoFromChannel(aChannel);
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
@@ -8911,11 +8940,8 @@ nsresult nsDocShell::HandleSameDocumentNavigation(
|
||||
this, mLoadingEntry->mInfo.GetURI()->GetSpecOrDefault().get()));
|
||||
bool hadActiveEntry = !!mActiveEntry;
|
||||
mActiveEntry = MakeUnique<SessionHistoryInfo>(mLoadingEntry->mInfo);
|
||||
// We're passing in mCurrentURI, which could be null. SessionHistoryCommit
|
||||
// does require a non-null uri if this is for a refresh load of the same
|
||||
// URI, but in that case mCurrentURI won't be null here.
|
||||
mBrowsingContext->SessionHistoryCommit(
|
||||
*mLoadingEntry, mLoadType, mCurrentURI, hadActiveEntry, true, true,
|
||||
*mLoadingEntry, mLoadType, hadActiveEntry, true, true,
|
||||
/* No expiration update on the same document loads*/
|
||||
false);
|
||||
// FIXME Need to set postdata.
|
||||
@@ -10740,6 +10766,14 @@ nsresult nsDocShell::ScrollToAnchor(bool aCurHasRef, bool aNewHasRef,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsDocShell::SetupReferrerInfoFromChannel(nsIChannel* aChannel) {
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(aChannel));
|
||||
if (httpChannel) {
|
||||
nsCOMPtr<nsIReferrerInfo> referrerInfo = httpChannel->GetReferrerInfo();
|
||||
SetReferrerInfo(referrerInfo);
|
||||
}
|
||||
}
|
||||
|
||||
bool nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel,
|
||||
nsIPrincipal* aTriggeringPrincipal,
|
||||
nsIPrincipal* aPrincipalToInherit,
|
||||
@@ -10964,13 +10998,14 @@ bool nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel,
|
||||
SetCurrentURI(aURI, aChannel, aFireOnLocationChange,
|
||||
/* aIsInitialAboutBlank */ false, locationFlags);
|
||||
// Make sure to store the referrer from the channel, if any
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(aChannel));
|
||||
if (httpChannel) {
|
||||
mReferrerInfo = httpChannel->GetReferrerInfo();
|
||||
}
|
||||
SetupReferrerInfoFromChannel(aChannel);
|
||||
return onLocationChangeNeeded;
|
||||
}
|
||||
|
||||
void nsDocShell::SetReferrerInfo(nsIReferrerInfo* aReferrerInfo) {
|
||||
mReferrerInfo = aReferrerInfo; // This assigment addrefs
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShell: Session History
|
||||
//*****************************************************************************
|
||||
@@ -13437,13 +13472,8 @@ void nsDocShell::MoveLoadingToActiveEntry(bool aPersist, bool aExpired) {
|
||||
MOZ_ASSERT(loadingEntry);
|
||||
uint32_t loadType =
|
||||
mLoadType == LOAD_ERROR_PAGE ? mFailedLoadType : mLoadType;
|
||||
|
||||
// We're passing in mCurrentURI, which could be null. SessionHistoryCommit
|
||||
// does require a non-null uri if this is for a refresh load of the same
|
||||
// URI, but in that case mCurrentURI won't be null here.
|
||||
mBrowsingContext->SessionHistoryCommit(*loadingEntry, loadType, mCurrentURI,
|
||||
hadActiveEntry, aPersist, false,
|
||||
aExpired);
|
||||
mBrowsingContext->SessionHistoryCommit(
|
||||
*loadingEntry, loadType, hadActiveEntry, aPersist, false, aExpired);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user