Backed out changeset 426e74dbe01e (bug 1731210) for causing lint failure on browser_beforeunload_permit_http.js CLOSED TREE

This commit is contained in:
Norisz Fay
2022-09-08 11:59:30 +03:00
parent a5785473b9
commit b1592c0152
4 changed files with 1 additions and 167 deletions

View File

@@ -9443,32 +9443,7 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
if (!isJavaScript && isNotDownload &&
!aLoadState->NotifiedBeforeUnloadListeners() && mContentViewer) {
bool okToUnload;
// Check if request is exempted from HTTPSOnlyMode and if https-first is
// enabled, if so it means:
// * https-first failed to upgrade request to https
// * we already asked for permission to unload and the user accepted
// otherwise we wouldn't be here.
bool isPrivateWin = GetOriginAttributes().mPrivateBrowsingId > 0;
bool isReloading = false;
uint32_t loadType = aLoadState->LoadType();
// Check if request is a reload.
if (loadType == LOAD_RELOAD_NORMAL) {
isReloading = true;
}
// If it isn't a reload, the request already failed to be upgraded and
// https-first is enabled then don't ask the user again for permission to
// unload and just unload.
if (!isReloading && aLoadState->IsExemptFromHTTPSOnlyMode() &&
nsHTTPSOnlyUtils::IsHttpsFirstModeEnabled(isPrivateWin)) {
rv = mContentViewer->PermitUnload(
nsIContentViewer::PermitUnloadAction::eDontPromptAndUnload,
&okToUnload);
} else {
rv = mContentViewer->PermitUnload(&okToUnload);
}
rv = mContentViewer->PermitUnload(&okToUnload);
if (NS_SUCCEEDED(rv) && !okToUnload) {
// The user chose not to unload the page, interrupt the