mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1044490 - Follow app redirects during <meta refresh> navigation. r=bz
This commit is contained in:
parent
503662b319
commit
3f1d141885
@ -6162,6 +6162,35 @@ nsDocShell::ForceRefreshURIFromTimer(nsIURI * aURI,
|
||||
return ForceRefreshURI(aURI, aDelay, aMetaRefresh);
|
||||
}
|
||||
|
||||
bool
|
||||
nsDocShell::DoAppRedirectIfNeeded(nsIURI * aURI,
|
||||
nsIDocShellLoadInfo * aLoadInfo,
|
||||
bool aFirstParty)
|
||||
{
|
||||
uint32_t appId;
|
||||
nsresult rv = GetAppId(&appId);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (appId != nsIScriptSecurityManager::NO_APP_ID &&
|
||||
appId != nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
||||
nsCOMPtr<nsIAppsService> appsService =
|
||||
do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
NS_ASSERTION(appsService, "No AppsService available");
|
||||
nsCOMPtr<nsIURI> redirect;
|
||||
rv = appsService->GetRedirect(appId, aURI, getter_AddRefs(redirect));
|
||||
if (NS_SUCCEEDED(rv) && redirect) {
|
||||
rv = LoadURI(redirect, aLoadInfo, nsIWebNavigation::LOAD_FLAGS_NONE, aFirstParty);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::ForceRefreshURI(nsIURI * aURI,
|
||||
int32_t aDelay,
|
||||
@ -6215,6 +6244,10 @@ nsDocShell::ForceRefreshURI(nsIURI * aURI,
|
||||
loadInfo->SetLoadType(nsIDocShellLoadInfo::loadRefresh);
|
||||
}
|
||||
|
||||
if (DoAppRedirectIfNeeded(aURI, loadInfo, true)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* LoadURI(...) will cancel all refresh timers... This causes the
|
||||
* Timer and its refreshData instance to be released...
|
||||
@ -6848,29 +6881,10 @@ nsDocShell::OnRedirectStateChange(nsIChannel* aOldChannel,
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if we have a redirect registered for this url.
|
||||
uint32_t appId;
|
||||
nsresult rv = GetAppId(&appId);
|
||||
if (NS_FAILED(rv)) {
|
||||
if (DoAppRedirectIfNeeded(newURI, nullptr, false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (appId != nsIScriptSecurityManager::NO_APP_ID &&
|
||||
appId != nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
||||
nsCOMPtr<nsIAppsService> appsService =
|
||||
do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
NS_ASSERTION(appsService, "No AppsService available");
|
||||
nsCOMPtr<nsIURI> redirect;
|
||||
rv = appsService->GetRedirect(appId, newURI, getter_AddRefs(redirect));
|
||||
if (NS_SUCCEEDED(rv) && redirect) {
|
||||
aNewChannel->Cancel(NS_BINDING_ABORTED);
|
||||
rv = LoadURI(redirect, nullptr, 0, false);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Below a URI visit is saved (see AddURIVisit method doc).
|
||||
// The visit chain looks something like:
|
||||
// ...
|
||||
|
@ -640,6 +640,12 @@ protected:
|
||||
|
||||
// Convenience method for getting our parent docshell. Can return null
|
||||
already_AddRefed<nsDocShell> GetParentDocshell();
|
||||
|
||||
// Check if we have an app redirect registered for the URI and redirect if
|
||||
// needed. Returns true if a redirect happened, false otherwise.
|
||||
bool DoAppRedirectIfNeeded(nsIURI * aURI,
|
||||
nsIDocShellLoadInfo * aLoadInfo,
|
||||
bool aFirstParty);
|
||||
protected:
|
||||
nsresult GetCurScrollPos(int32_t scrollOrientation, int32_t * curPos);
|
||||
nsresult SetCurScrollPosEx(int32_t curHorizontalPos, int32_t curVerticalPos);
|
||||
|
Loading…
Reference in New Issue
Block a user