Title: [221819] trunk/Tools
- Revision
- 221819
- Author
- [email protected]
- Date
- 2017-09-09 08:31:21 -0700 (Sat, 09 Sep 2017)
Log Message
MiniBrowser closes tab instead of window on close signal
https://bugs.webkit.org/show_bug.cgi?id=176587
Reviewed by Carlos Garcia Campos.
This has been broken since we added support for multiple tabs. We need to run try_close for
every open tab, not just the current one. If there are no onbeforeonload handlers then all
tabs will close; if there are some, then they'll be respected, but the remaining tabs will
be closed.
Note that we cannot simply iterate through the tabs of the GtkNotebook, as we'd be deleting
tabs as we go, so save all the tabs into a separate list and then try to close each in turn.
* MiniBrowser/gtk/BrowserWindow.c:
(browserWindowTryClose):
(browserWindowDeleteEvent):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (221818 => 221819)
--- trunk/Tools/ChangeLog 2017-09-09 15:28:36 UTC (rev 221818)
+++ trunk/Tools/ChangeLog 2017-09-09 15:31:21 UTC (rev 221819)
@@ -1,3 +1,22 @@
+2017-09-09 Michael Catanzaro <[email protected]>
+
+ MiniBrowser closes tab instead of window on close signal
+ https://bugs.webkit.org/show_bug.cgi?id=176587
+
+ Reviewed by Carlos Garcia Campos.
+
+ This has been broken since we added support for multiple tabs. We need to run try_close for
+ every open tab, not just the current one. If there are no onbeforeonload handlers then all
+ tabs will close; if there are some, then they'll be respected, but the remaining tabs will
+ be closed.
+
+ Note that we cannot simply iterate through the tabs of the GtkNotebook, as we'd be deleting
+ tabs as we go, so save all the tabs into a separate list and then try to close each in turn.
+
+ * MiniBrowser/gtk/BrowserWindow.c:
+ (browserWindowTryClose):
+ (browserWindowDeleteEvent):
+
2017-09-09 Zan Dobersek <[email protected]>
Unreviewed WPE build fix.
Modified: trunk/Tools/MiniBrowser/gtk/BrowserWindow.c (221818 => 221819)
--- trunk/Tools/MiniBrowser/gtk/BrowserWindow.c 2017-09-09 15:28:36 UTC (rev 221818)
+++ trunk/Tools/MiniBrowser/gtk/BrowserWindow.c 2017-09-09 15:31:21 UTC (rev 221819)
@@ -1045,12 +1045,27 @@
g_bytes_unref(bytes);
}
+static void browserWindowTryClose(BrowserWindow *window)
+{
+ GSList *webViews = NULL;
+ int n = gtk_notebook_get_n_pages(GTK_NOTEBOOK(window->notebook));
+ int i;
+
+ for (i = 0; i < n; ++i) {
+ BrowserTab *tab = (BrowserTab *)gtk_notebook_get_nth_page(GTK_NOTEBOOK(window->notebook), i);
+ webViews = g_slist_prepend(webViews, browser_tab_get_web_view(tab));
+ }
+
+ GSList *link;
+ for (link = webViews; link; link = link->next)
+ webkit_web_view_try_close(link->data);
+}
+
static gboolean browserWindowDeleteEvent(GtkWidget *widget, GdkEventAny* event)
{
BrowserWindow *window = BROWSER_WINDOW(widget);
browserWindowSaveSession(window);
- WebKitWebView *webView = browser_tab_get_web_view(window->activeTab);
- webkit_web_view_try_close(webView);
+ browserWindowTryClose(window);
return TRUE;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes