Bug 1195242 - force malware and phishing block warnings to break out of frames at the docshell level, r?bz
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -4947,16 +4947,27 @@ nsDocShell::DisplayLoadError(nsresult aE
} else {
error.AssignLiteral("nssFailure2");
}
}
} else if (NS_ERROR_PHISHING_URI == aError ||
NS_ERROR_MALWARE_URI == aError ||
NS_ERROR_UNWANTED_URI == aError ||
NS_ERROR_FORBIDDEN_URI == aError) {
+ // This ensures we never display the error page in a frame:
+ nsCOMPtr<nsIDocShellTreeItem> parent;
+ GetSameTypeParent(getter_AddRefs(parent));
+ if (parent) {
+ nsCOMPtr<nsIDocShellTreeItem> sameTypeRoot;
+ parent->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot));
+ nsCOMPtr<nsIDocShell> rootShell = do_QueryInterface(sameTypeRoot);
+ return rootShell->DisplayLoadError(aError, aURI, aURL, aFailedChannel,
+ aDisplayedErrorPage);
+ }
+
nsAutoCString host;
aURI->GetHost(host);
CopyUTF8toUTF16(host, formatStrs[0]);
formatStrCount = 1;
// Malware and phishing detectors may want to use an alternate error
// page, but if the pref's not set, we'll fall back on the standard page
nsAdoptingCString alternateErrorPage =