import changes from tenfourfox:

bug1414425, bug1418922, bug1422389, bug1423159, bug1399400(ported), bug1395508, bug1425000, bug1425780, bug1425612(ported), bug1426783
#438: revert M1371908 for startup assertions and crashes
#457: M1419363 + WeakPtr support from M1267918
This commit is contained in:
2018-08-05 17:44:28 +08:00
parent a4a0d109c7
commit adc2398eb5
21 changed files with 147 additions and 93 deletions
+19 -8
View File
@@ -6623,8 +6623,10 @@ nsDocShell::ScrollByPages(int32_t aNumPages)
//*****************************************************************************
NS_IMETHODIMP
nsDocShell::RefreshURI(nsIURI* aURI, int32_t aDelay, bool aRepeat,
bool aMetaRefresh)
nsDocShell::RefreshURI(nsIURI* aURI,
int32_t aDelay, bool aRepeat,
bool aMetaRefresh,
nsIPrincipal* aPrincipal)
{
NS_ENSURE_ARG(aURI);
@@ -6659,6 +6661,7 @@ nsDocShell::RefreshURI(nsIURI* aURI, int32_t aDelay, bool aRepeat,
nsCOMPtr<nsISupports> dataRef = refreshTimer; // Get the ref count to 1
refreshTimer->mDocShell = this;
refreshTimer->mPrincipal = aPrincipal;
refreshTimer->mURI = aURI;
refreshTimer->mDelay = aDelay;
refreshTimer->mRepeat = aRepeat;
@@ -6690,7 +6693,8 @@ nsresult
nsDocShell::ForceRefreshURIFromTimer(nsIURI* aURI,
int32_t aDelay,
bool aMetaRefresh,
nsITimer* aTimer)
nsITimer* aTimer,
nsIPrincipal* aPrincipal)
{
NS_PRECONDITION(aTimer, "Must have a timer here");
@@ -6708,7 +6712,7 @@ nsDocShell::ForceRefreshURIFromTimer(nsIURI* aURI,
}
}
return ForceRefreshURI(aURI, aDelay, aMetaRefresh);
return ForceRefreshURI(aURI, aDelay, aMetaRefresh, aPrincipal);
}
bool
@@ -6742,7 +6746,7 @@ nsDocShell::DoAppRedirectIfNeeded(nsIURI* aURI,
}
NS_IMETHODIMP
nsDocShell::ForceRefreshURI(nsIURI* aURI, int32_t aDelay, bool aMetaRefresh)
nsDocShell::ForceRefreshURI(nsIURI* aURI, int32_t aDelay, bool aMetaRefresh, nsIPrincipal* aPrincipal)
{
NS_ENSURE_ARG(aURI);
@@ -6790,11 +6794,18 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, int32_t aDelay, bool aMetaRefresh)
loadInfo->SetLoadType(nsIDocShellLoadInfo::loadRefresh);
}
// If the principal is null, the refresh will have a triggeringPrincipal
// derived from the referrer URI, or will be set to the system principal
// if there is no refererrer. See LoadURI()
if (aPrincipal) {
loadInfo->SetOwner(aPrincipal); // as called prior to bug 1286472
}
/*
* LoadURI(...) will cancel all refresh timers... This causes the
* Timer and its refreshData instance to be released...
*/
LoadURI(aURI, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE, true);
LoadURI(aURI, loadInfo, nsIWebNavigation::LOAD_FLAGS_DISALLOW_INHERIT_OWNER, true); // XXX: LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL
return NS_OK;
}
@@ -7030,7 +7041,7 @@ nsDocShell::SetupRefreshURIFromHeader(nsIURI* aBaseURI,
return NS_ERROR_FAILURE;
}
rv = RefreshURI(uri, seconds * 1000, false, true);
rv = RefreshURI(uri, seconds * 1000, false, true, aPrincipal);
}
}
}
@@ -13116,7 +13127,7 @@ nsRefreshTimer::Notify(nsITimer* aTimer)
// Get the delay count to determine load type
uint32_t delay = 0;
aTimer->GetDelay(&delay);
mDocShell->ForceRefreshURIFromTimer(mURI, delay, mMetaRefresh, aTimer);
mDocShell->ForceRefreshURIFromTimer(mURI, delay, mMetaRefresh, aTimer, mPrincipal);
}
return NS_OK;
}