On Sun, Jul 06, 2008 at 01:03:54PM +0200, Mike Hommey wrote:
> On Sun, Jul 06, 2008 at 12:42:01PM +0200, Andreas Barth wrote:
> > Hi,
> > 
> > * Mike Hommey ([EMAIL PROTECTED]) [080706 10:41]:
> > > On Fri, Jun 20, 2008 at 11:28:05AM +0200, Alexander Sack <[EMAIL 
> > > PROTECTED]> wrote:
> > > > On Fri, Jun 20, 2008 at 01:07:09AM +0200, Mike Hommey wrote:
> > > > > On Fri, Jun 20, 2008 at 12:43:04AM +0200, Mike Hommey wrote:
> > > > > > On Fri, Jun 20, 2008 at 12:38:52AM +0200, Mike Hommey wrote:
> > > > > > > On Wed, Jun 18, 2008 at 12:48:42AM +0200, Josselin Mouette wrote:
> > > > > > > > Le mercredi 18 juin 2008 à 00:18 +0200, Mazen NEIFER a écrit :
> > > > > > > > > Browse
> > > > > > > > > http://aljazeera.net/NR/exeres/8BAC4176-2B16-450F-B8DA-7127702A17AF.htm
> > > > > > > > >  and try to increase font size and it will crash.
> > > > > > > > 
> > > > > > > > This is indeed reproducible. Interestingly enough, a very 
> > > > > > > > similar bug
> > > > > > > > happens in devhelp when trying to increase the font size.
> > > > > > > > 
> > > > > > > > I???m attaching a full backtrace with debugging symbols.
> > > > > > > 
> > > > > > > Interestingly, while I can reproduce with epiphany, I can't with
> > > > > > > iceweasel. Some values of the zoom factor may be triggering this
> > > > > > > issue...
> > > > > > 
> > > > > > FWIW, iceweasel is setting zoom factor to 1.1, 1.2, 1.3, ...
> > > > > 
> > > > > I tried some less intriguing values for zoom factors in epiphany, and 
> > > > > it
> > > > > didn't change anything. It still crashes.
> > > > > 
> > > > 
> > > > We had this "zoom" crash here _before_ respinning epiphany-browser on
> > > > top of the final xulrunner .... Are you sure its a fresh build?
> > > 
> > > I build it myself yesterday. Though not against final xulrunner, but rc2,
> > > which is the same.
> > 
> > Any news on this bug? Does it still happen? How bad is it, should it
> > block testing migration?
> 
> It still happens reliably for me with the given url, though it doesn't
> happen with other urls. So I would say it is not /that/ bad.

Now, I got to the point where I don't know where the bug is anymore...

I roughly duplicated epiphany code for zoom handling in the gtkembed
test in xulrunner (in case it would make a difference whether the zoom
API is called from javascript or C) and... it doesn't crash...

Attached, you'll find a patch for this test. If you want to try for
yourself, apply it to current xulrunner source, run debian/rules build,
then make -C embedding/browser/gtk/tests, and finally,
dist/bin/run-mozilla.sh embedding/browser/gtk/tests/TestGtkEmbed

Then go to the aljazeera.net url, and click on zoom (you can click
several times, but not too many times, there is no failsafe)

Mike
diff --git a/embedding/browser/gtk/tests/Makefile.in 
b/embedding/browser/gtk/tests/Makefile.in
index 9eb984a..984e4b0 100644
--- a/embedding/browser/gtk/tests/Makefile.in
+++ b/embedding/browser/gtk/tests/Makefile.in
@@ -46,6 +46,7 @@ include $(DEPTH)/config/autoconf.mk
 MODULE         = gtkembedmoz
 REQUIRES       = xpcom \
                  dom \
+                 docshell \
                  $(NULL)
 
 CPPSRCS         = \
diff --git a/embedding/browser/gtk/tests/TestGtkEmbed.cpp 
b/embedding/browser/gtk/tests/TestGtkEmbed.cpp
index 3c7223d..8170aaf 100644
--- a/embedding/browser/gtk/tests/TestGtkEmbed.cpp
+++ b/embedding/browser/gtk/tests/TestGtkEmbed.cpp
@@ -51,6 +51,11 @@
 #include "nsServiceManagerUtils.h"
 #include "nsIObserverService.h"
 
+#include "nsIInterfaceRequestorUtils.h"
+#include "nsIDocShell.h"
+#include "nsIContentViewer.h"
+#include "nsIMarkupDocumentViewer.h"
+
 #include "nsStringAPI.h"
 #include "gtkmozembed_glue.cpp"
 
@@ -71,6 +76,7 @@ typedef struct _TestGtkBrowser {
   GtkWidget  *stopButton;
   GtkWidget  *forwardButton;
   GtkWidget  *reloadButton;
+  GtkWidget  *zoomButton;
   GtkWidget  *urlEntry;
   GtkWidget  *mozEmbed;
   GtkWidget  *progressAreaHBox;
@@ -107,6 +113,8 @@ static void     forward_clicked_cb (GtkButton   *button,
                                    TestGtkBrowser *browser);
 static void     reload_clicked_cb  (GtkButton   *button,
                                    TestGtkBrowser *browser);
+static void     zoom_clicked_cb    (GtkButton   *button,
+                                   TestGtkBrowser *browser);
 static void     url_activate_cb    (GtkEditable *widget, 
                                    TestGtkBrowser *browser);
 static void     menu_open_new_cb   (GtkMenuItem *menuitem,
@@ -221,6 +229,12 @@ main(int argc, char **argv)
     return 1;
   }
 
+  rv = GTKEmbedGlueStartupInternal();
+  if (NS_FAILED(rv)) {
+    fprintf(stderr, "Couldn't find GTKMozEmbed symbols.");
+    return 1;
+  }
+
   char *lastSlash = strrchr(xpcomPath, '/');
   if (lastSlash)
     *lastSlash = '\0';
@@ -416,6 +430,16 @@ new_gtk_browser(guint32 chromeMask)
                            0, // XXX replace with icon
                            GTK_SIGNAL_FUNC(reload_clicked_cb),
                            browser);
+
+  // new zoom button
+  browser->zoomButton =
+    gtk_toolbar_append_item(GTK_TOOLBAR(browser->toolbar),
+                           "Zoom",
+                           "Zoom",
+                           "Zoom",
+                           0, // XXX replace with icon
+                           GTK_SIGNAL_FUNC(zoom_clicked_cb),
+                           browser);
   // create the url text entry
   browser->urlEntry = gtk_entry_new();
   // add it to the hbox
@@ -463,6 +487,7 @@ new_gtk_browser(guint32 chromeMask)
   gtk_widget_set_sensitive(browser->stopButton, FALSE);
   gtk_widget_set_sensitive(browser->forwardButton, FALSE);
   gtk_widget_set_sensitive(browser->reloadButton, FALSE);
+  gtk_widget_set_sensitive(browser->zoomButton, FALSE);
   
   // catch the destruction of the toplevel window
   gtk_signal_connect(GTK_OBJECT(browser->topLevelWindow), "delete_event",
@@ -634,6 +659,27 @@ reload_clicked_cb  (GtkButton *button, TestGtkBrowser 
*browser)
                       GTK_MOZ_EMBED_FLAG_RELOADNORMAL);
 }
 
+static const float zoom_levels[] =
+{
+1.0, 1.1892071149, 1.4142135623, 1.6817928304, 2.0, 2.8284271247, 4.0
+};
+
+static const float *current_zoom_level = zoom_levels;
+
+void
+zoom_clicked_cb  (GtkButton *button, TestGtkBrowser *browser)
+{
+  g_print("zoom_clicked_cb\n");
+  nsCOMPtr<nsIWebBrowser> webBrowser;
+  gtk_moz_embed_get_nsIWebBrowser(GTK_MOZ_EMBED(browser->mozEmbed),
+                                  getter_AddRefs(webBrowser));
+  nsCOMPtr<nsIDocShell> docShell(do_GetInterface(webBrowser));
+  nsCOMPtr<nsIContentViewer> contentViewer;
+  docShell->GetContentViewer(getter_AddRefs(contentViewer));
+  nsCOMPtr<nsIMarkupDocumentViewer> mdv = do_QueryInterface(contentViewer);
+  mdv->SetTextZoom(*(++current_zoom_level));
+}
+
 void 
 stream_clicked_cb  (GtkButton   *button, TestGtkBrowser *browser)
 {
@@ -815,6 +861,7 @@ load_finished_cb    (GtkMozEmbed *embed, TestGtkBrowser 
*browser)
   g_print("load_finished_cb\n");
   gtk_widget_set_sensitive(browser->stopButton, FALSE);
   gtk_widget_set_sensitive(browser->reloadButton, TRUE);
+  gtk_widget_set_sensitive(browser->zoomButton, TRUE);
   browser->loadPercent = 0;
   browser->bytesLoaded = 0;
   browser->maxBytesLoaded = 0;

Reply via email to