aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-01-06 07:44:38 +0800
committerChristian Persch <chpe@src.gnome.org>2004-01-06 07:44:38 +0800
commit6214eca8f29c0623fc13c80d1310c94f65b98191 (patch)
tree2b0afb731893cdc600035940c0a8a3222325a0fa
parent3a041befc28c45d9213387489f491534a4041164 (diff)
downloadgsoc2013-epiphany-6214eca8f29c0623fc13c80d1310c94f65b98191.tar
gsoc2013-epiphany-6214eca8f29c0623fc13c80d1310c94f65b98191.tar.gz
gsoc2013-epiphany-6214eca8f29c0623fc13c80d1310c94f65b98191.tar.bz2
gsoc2013-epiphany-6214eca8f29c0623fc13c80d1310c94f65b98191.tar.lz
gsoc2013-epiphany-6214eca8f29c0623fc13c80d1310c94f65b98191.tar.xz
gsoc2013-epiphany-6214eca8f29c0623fc13c80d1310c94f65b98191.tar.zst
gsoc2013-epiphany-6214eca8f29c0623fc13c80d1310c94f65b98191.zip
Ensure that if the nsIDOMWindow provided is a frame inside an embed, we
2004-01-06 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/MozillaPrivate.cpp: * embed/mozilla/PrintingPromptService.cpp: Ensure that if the nsIDOMWindow provided is a frame inside an embed, we get the top-level window and then get the embed from that. Fixes bug #129028.
-rw-r--r--ChangeLog9
-rw-r--r--embed/mozilla/MozillaPrivate.cpp25
-rw-r--r--embed/mozilla/PrintingPromptService.cpp4
3 files changed, 28 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index ede10b4f3..c359a7a25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2004-01-06 Christian Persch <chpe@cvs.gnome.org>
+
+ * embed/mozilla/MozillaPrivate.cpp:
+ * embed/mozilla/PrintingPromptService.cpp:
+
+ Ensure that if the nsIDOMWindow provided is a frame inside an embed,
+ we get the top-level window and then get the embed from that.
+ Fixes bug #129028.
+
2004-01-04 Christian Persch <chpe@cvs.gnome.org>
* src/window-commands.c: (window_cmd_help_about):
diff --git a/embed/mozilla/MozillaPrivate.cpp b/embed/mozilla/MozillaPrivate.cpp
index 1950f0e6c..f793f5e5e 100644
--- a/embed/mozilla/MozillaPrivate.cpp
+++ b/embed/mozilla/MozillaPrivate.cpp
@@ -15,28 +15,37 @@ GtkWidget *MozillaFindEmbed (nsIDOMWindow *aDOMWindow)
nsCOMPtr<nsIWindowWatcher> wwatch
(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
- if (!wwatch) return nsnull;
+ NS_ENSURE_TRUE (wwatch, nsnull);
- nsCOMPtr<nsIDOMWindow> domWindow(aDOMWindow);
- if (!domWindow)
+ nsCOMPtr<nsIDOMWindow> domWindow;
+ if (aDOMWindow)
{
- result = wwatch->GetActiveWindow(getter_AddRefs(domWindow));
- if (NS_FAILED(result) || !domWindow) return nsnull;
+ /* 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);
nsCOMPtr<nsIWebBrowserChrome> windowChrome;
result = wwatch->GetChromeForWindow (domWindow,
getter_AddRefs(windowChrome));
- if (NS_FAILED(result)) return nsnull;
+ NS_ENSURE_TRUE (windowChrome, nsnull);
nsCOMPtr<nsIEmbeddingSiteWindow> window
(do_QueryInterface(windowChrome, &result));
- if (NS_FAILED(result)) return nsnull;
+ NS_ENSURE_TRUE (window, nsnull);
GtkWidget *mozembed;
result = window->GetSiteWindow ((void **)&mozembed);
- if (NS_FAILED(result)) return nsnull;
+ NS_ENSURE_SUCCESS (result, nsnull);
+ g_print ("returning %p\n", mozembed);
return mozembed;
}
diff --git a/embed/mozilla/PrintingPromptService.cpp b/embed/mozilla/PrintingPromptService.cpp
index 1da92c113..79059b10f 100644
--- a/embed/mozilla/PrintingPromptService.cpp
+++ b/embed/mozilla/PrintingPromptService.cpp
@@ -53,10 +53,10 @@ NS_IMETHODIMP GPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIW
nsresult rv = NS_ERROR_ABORT;
GtkWidget *gtkParent = MozillaFindGtkParent(parent);
- if (!gtkParent) return NS_ERROR_ABORT;
+ NS_ENSURE_TRUE (gtkParent, NS_ERROR_FAILURE);
EphyEmbed *embed = EPHY_EMBED (MozillaFindEmbed (parent));
- if (!embed) return NS_ERROR_ABORT;
+ NS_ENSURE_TRUE (embed, NS_ERROR_FAILURE);
dialog = ephy_print_dialog_new (gtkParent, embed, TRUE);
ephy_dialog_set_modal (dialog, TRUE);