Bug 1725489 - Add loadType flags to nsITopLevelNavigationDelegate.shouldNavigate. r=smaug
This will, for example, make it possible to behave differently for a normal navigation, a reload navigation, a history navigation, and a pushstate navigation. Differential Revision: https://phabricator.services.mozilla.com/D122532
This commit is contained in:
@@ -9225,10 +9225,10 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
|
||||
if (referrerInfo) {
|
||||
referrerInfo->GetOriginalReferrer(getter_AddRefs(referrer));
|
||||
}
|
||||
rv = delegate->ShouldNavigate(this, aLoadState->URI(), referrer,
|
||||
!!aLoadState->PostDataStream(),
|
||||
aLoadState->TriggeringPrincipal(),
|
||||
aLoadState->Csp(), &shouldNavigate);
|
||||
rv = delegate->ShouldNavigate(
|
||||
this, aLoadState->URI(), aLoadState->LoadType(), referrer,
|
||||
!!aLoadState->PostDataStream(), aLoadState->TriggeringPrincipal(),
|
||||
aLoadState->Csp(), &shouldNavigate);
|
||||
if (NS_SUCCEEDED(rv) && !shouldNavigate) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ class TopLevelNavigationDelegateChild extends JSWindowActorChild {
|
||||
shouldNavigate(
|
||||
docShell,
|
||||
URI,
|
||||
loadType,
|
||||
referrer,
|
||||
hasPostData,
|
||||
triggeringPrincipal,
|
||||
|
||||
@@ -22,7 +22,9 @@ interface nsITopLevelNavigationDelegate : nsISupports
|
||||
/**
|
||||
* @param nsIDocShell docShell The nsIDocShell performing the navigation.
|
||||
* @param nsIURI linkURI The URI that the nsIDocShell is trying to
|
||||
* navigate to.
|
||||
* navigate to.
|
||||
* @param unsigned long loadType Contains a load type for the navigation as
|
||||
* specified by the load constants in nsIDocShell:LoadCommand.
|
||||
* @param nsIURI referrer
|
||||
* The referrer of the load.
|
||||
* @param boolean hasPostData
|
||||
@@ -34,10 +36,11 @@ interface nsITopLevelNavigationDelegate : nsISupports
|
||||
* The CSP to be used for that load. That is the CSP that e.g. upgrades
|
||||
* the load to HTTPS in case upgrade-insecure-requests is set.
|
||||
* @return boolean True if the nsIDocShell should proceed with the
|
||||
* navigation.
|
||||
* navigation.
|
||||
*/
|
||||
bool shouldNavigate(in nsIDocShell docShell,
|
||||
in nsIURI linkURI,
|
||||
in unsigned long loadType,
|
||||
in nsIURI referrer,
|
||||
in boolean hasPostData,
|
||||
in nsIPrincipal triggeringPrincipal,
|
||||
|
||||
Reference in New Issue
Block a user