From 1776f51ef631ba6d9a871e97d00514f3b3be6df4 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Fri, 14 Sep 2007 19:21:45 +0000 Subject: [PATCH] Add a flag to nsIWebNavigation to disable popup-blocking for loads as needed. Bug 278357, r=biesi, sr=jst, a=bsmedberg --- docshell/base/nsDocShell.cpp | 10 ++++++++++ docshell/base/nsIWebNavigation.idl | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index fa2f62ecd4c..8dd14bc8092 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -2801,6 +2801,16 @@ nsDocShell::LoadURI(const PRUnichar * aURI, if (NS_FAILED(rv) || !uri) return NS_ERROR_FAILURE; + PopupControlState popupState; + if (aLoadFlags & LOAD_FLAGS_ALLOW_POPUPS) { + popupState = openAllowed; + aLoadFlags &= ~LOAD_FLAGS_ALLOW_POPUPS; + } else { + popupState = openOverridden; + } + nsCOMPtr win(do_QueryInterface(mScriptGlobal)); + nsAutoPopupStatePusher statePusher(win, popupState); + // Don't pass certain flags that aren't needed and end up confusing // ConvertLoadTypeToDocShellLoadInfo. We do need to ensure that they are // passed to LoadURI though, since it uses them. diff --git a/docshell/base/nsIWebNavigation.idl b/docshell/base/nsIWebNavigation.idl index cbc8e56ce29..a9dff965933 100644 --- a/docshell/base/nsIWebNavigation.idl +++ b/docshell/base/nsIWebNavigation.idl @@ -191,6 +191,12 @@ interface nsIWebNavigation : nsISupports */ const unsigned long LOAD_FLAGS_FIRST_LOAD = 0x4000; + /** + * This flag specifies that the load should not be subject to popup + * blocking checks. + */ + const unsigned long LOAD_FLAGS_ALLOW_POPUPS = 0x8000; + /** * Loads a given URI. This will give priority to loading the requested URI * in the object implementing this interface. If it can't be loaded here