From 5af89a28e1d5302f351a714a711ddc4ead5320b0 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Sat, 28 Feb 2004 10:47:03 +0000 Subject: Use getInterface to get the dom window from the docshell, not 2004-02-28 Marco Pesenti Gritti * embed/mozilla/ContentHandler.cpp: Use getInterface to get the dom window from the docshell, not queryInterface. (Bug #121160) * embed/mozilla/MozillaPrivate.cpp: Do not fallback to the active window if the parent cannot be found. It just hides problems and cause more annoying behaviors (like dialogs parented on the wrong window). --- embed/mozilla/ContentHandler.cpp | 9 +++------ embed/mozilla/MozillaPrivate.cpp | 24 +++++++++--------------- 2 files changed, 12 insertions(+), 21 deletions(-) (limited to 'embed') diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp index 622c95ca7..a92965638 100644 --- a/embed/mozilla/ContentHandler.cpp +++ b/embed/mozilla/ContentHandler.cpp @@ -34,8 +34,7 @@ #include "nsIURL.h" #include "nsILocalFile.h" #include "nsIMIMEInfo.h" - -#include "nsIWebNavigation.h" // Needed to create the LoadType flag +#include "nsIInterfaceRequestorUtils.h" #include "ephy-prefs.h" #include "eel-gconf-extensions.h" @@ -129,7 +128,7 @@ NS_IMETHODIMP GContentHandler::PromptForSaveToFile( _retval); } - nsCOMPtr parentDOMWindow = do_QueryInterface (aWindowContext); + nsCOMPtr parentDOMWindow = do_GetInterface (aWindowContext); GtkWidget *parentWindow = GTK_WIDGET (MozillaFindGtkParent (parentDOMWindow)); dialog = ephy_file_chooser_new (_("Save"), parentWindow, @@ -257,7 +256,7 @@ NS_METHOD GContentHandler::MIMEConfirmAction (PRBool autoDownload) char *text; int response; - nsCOMPtr parentDOMWindow = do_QueryInterface (mContext); + nsCOMPtr parentDOMWindow = do_GetInterface (mContext); GtkWindow *parentWindow = GTK_WINDOW (MozillaFindGtkParent(parentDOMWindow)); dialog = gtk_dialog_new_with_buttons @@ -278,8 +277,6 @@ NS_METHOD GContentHandler::MIMEConfirmAction (PRBool autoDownload) gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0); - g_print ("AAA %d %p", mPermission, mHelperApp); - if (mPermission == EPHY_MIME_PERMISSION_UNSAFE && mHelperApp) { text = g_strdup_printf ("%s\n\n%s", diff --git a/embed/mozilla/MozillaPrivate.cpp b/embed/mozilla/MozillaPrivate.cpp index d83509119..aacb2c629 100644 --- a/embed/mozilla/MozillaPrivate.cpp +++ b/embed/mozilla/MozillaPrivate.cpp @@ -35,27 +35,21 @@ GtkWidget *MozillaFindEmbed (nsIDOMWindow *aDOMWindow) { + if (!aDOMWindow) return nsnull; + nsCOMPtr wwatch (do_GetService("@mozilla.org/embedcomp/window-watcher;1")); NS_ENSURE_TRUE (wwatch, nsnull); - nsCOMPtr domWindow; - if (aDOMWindow) - { - /* this DOM window may belong to some inner frame, we need - * to get the topmost DOM window to get the embed - */ - aDOMWindow->GetTop (getter_AddRefs (domWindow)); - } - else - { - /* get the active window */ - wwatch->GetActiveWindow (getter_AddRefs(domWindow)); - } - NS_ENSURE_TRUE (domWindow, nsnull); + /* this DOM window may belong to some inner frame, we need + * to get the topmost DOM window to get the embed + */ + nsCOMPtr topWindow; + aDOMWindow->GetTop (getter_AddRefs (topWindow)); + if (!topWindow) return nsnull; nsCOMPtr windowChrome; - wwatch->GetChromeForWindow (domWindow, getter_AddRefs(windowChrome)); + wwatch->GetChromeForWindow (topWindow, getter_AddRefs(windowChrome)); NS_ENSURE_TRUE (windowChrome, nsnull); nsCOMPtr window (do_QueryInterface(windowChrome)); -- cgit v1.2.3