Changeset 221819 in webkit


Ignore:
Timestamp:
Sep 9, 2017 8:31:21 AM (7 years ago)
Author:
Michael Catanzaro
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):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r221814 r221819  
     12017-09-09  Michael Catanzaro  <mcatanzaro@igalia.com>
     2
     3        MiniBrowser closes tab instead of window on close signal
     4        https://bugs.webkit.org/show_bug.cgi?id=176587
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        This has been broken since we added support for multiple tabs. We need to run try_close for
     9        every open tab, not just the current one. If there are no onbeforeonload handlers then all
     10        tabs will close; if there are some, then they'll be respected, but the remaining tabs will
     11        be closed.
     12
     13        Note that we cannot simply iterate through the tabs of the GtkNotebook, as we'd be deleting
     14        tabs as we go, so save all the tabs into a separate list and then try to close each in turn.
     15
     16        * MiniBrowser/gtk/BrowserWindow.c:
     17        (browserWindowTryClose):
     18        (browserWindowDeleteEvent):
     19
    1202017-09-09  Zan Dobersek  <zdobersek@igalia.com>
    221
  • trunk/Tools/MiniBrowser/gtk/BrowserWindow.c

    r217620 r221819  
    10461046}
    10471047
     1048static void browserWindowTryClose(BrowserWindow *window)
     1049{
     1050    GSList *webViews = NULL;
     1051    int n = gtk_notebook_get_n_pages(GTK_NOTEBOOK(window->notebook));
     1052    int i;
     1053
     1054    for (i = 0; i < n; ++i) {
     1055        BrowserTab *tab = (BrowserTab *)gtk_notebook_get_nth_page(GTK_NOTEBOOK(window->notebook), i);
     1056        webViews = g_slist_prepend(webViews, browser_tab_get_web_view(tab));
     1057    }
     1058
     1059    GSList *link;
     1060    for (link = webViews; link; link = link->next)
     1061        webkit_web_view_try_close(link->data);
     1062}
     1063
    10481064static gboolean browserWindowDeleteEvent(GtkWidget *widget, GdkEventAny* event)
    10491065{
    10501066    BrowserWindow *window = BROWSER_WINDOW(widget);
    10511067    browserWindowSaveSession(window);
    1052     WebKitWebView *webView = browser_tab_get_web_view(window->activeTab);
    1053     webkit_web_view_try_close(webView);
     1068    browserWindowTryClose(window);
    10541069    return TRUE;
    10551070}
Note: See TracChangeset for help on using the changeset viewer.