Title: [286354] trunk/Source/WebKit
Revision
286354
Author
lmo...@igalia.com
Date
2021-12-01 00:21:48 -0800 (Wed, 01 Dec 2021)

Log Message

[GTK][GTK4][WebDriver] Flaky crashes exiting many prompty-related webdriver tests
https://bugs.webkit.org/show_bug.cgi?id=233505

Reviewed by Carlos Garcia Campos.

Covered by existing tests.

When building for GTK4, upon dialog closure the dialog widgets might
be removed with `webkitWebViewDialogSetChild(dialog, NULL)` while
the button is still registered as the default widget of the toplevel.

This commit makes sure we don't have a default widget while the
dialog is unmapped, to mirror the map() behavior.

* UIProcess/API/gtk/WebKitScriptDialogImpl.cpp:
(webkitScriptDialogImplUnmap): Added to unset the default widget.
(webkit_script_dialog_impl_class_init): Register unmap callback.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (286353 => 286354)


--- trunk/Source/WebKit/ChangeLog	2021-12-01 07:43:30 UTC (rev 286353)
+++ trunk/Source/WebKit/ChangeLog	2021-12-01 08:21:48 UTC (rev 286354)
@@ -1,3 +1,23 @@
+2021-12-01  Lauro Moura  <lmo...@igalia.com>
+
+        [GTK][GTK4][WebDriver] Flaky crashes exiting many prompty-related webdriver tests
+        https://bugs.webkit.org/show_bug.cgi?id=233505
+
+        Reviewed by Carlos Garcia Campos.
+
+        Covered by existing tests.
+
+        When building for GTK4, upon dialog closure the dialog widgets might
+        be removed with `webkitWebViewDialogSetChild(dialog, NULL)` while
+        the button is still registered as the default widget of the toplevel.
+
+        This commit makes sure we don't have a default widget while the
+        dialog is unmapped, to mirror the map() behavior.
+
+        * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp:
+        (webkitScriptDialogImplUnmap): Added to unset the default widget.
+        (webkit_script_dialog_impl_class_init): Register unmap callback.
+
 2021-11-30  Antoine Quint  <grao...@apple.com>
 
         replace-webkit-additions-includes should assume unknown or empty deployment targets are supported

Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitScriptDialogImpl.cpp (286353 => 286354)


--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitScriptDialogImpl.cpp	2021-12-01 07:43:30 UTC (rev 286353)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitScriptDialogImpl.cpp	2021-12-01 08:21:48 UTC (rev 286354)
@@ -74,6 +74,20 @@
 }
 #endif
 
+#if USE(GTK4)
+static void webkitScriptDialogImplUnmap(GtkWidget* widget)
+{
+    if (!gtk_widget_get_mapped(widget))
+        return;
+
+    auto* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(widget));
+    if (WebCore::widgetIsOnscreenToplevelWindow(toplevel))
+        gtk_window_set_default(GTK_WINDOW(toplevel), nullptr);
+
+    GTK_WIDGET_CLASS(webkit_script_dialog_impl_parent_class)->unmap(widget);
+}
+#endif
+
 static void webkitScriptDialogImplMap(GtkWidget* widget)
 {
     WebKitScriptDialogImplPrivate* priv = WEBKIT_SCRIPT_DIALOG_IMPL(widget)->priv;
@@ -235,6 +249,9 @@
     widgetClass->key_press_event = webkitScriptDialogImplKeyPressEvent;
 #endif
     widgetClass->map = webkitScriptDialogImplMap;
+#if USE(GTK4)
+    widgetClass->unmap = webkitScriptDialogImplUnmap;
+#endif
 #if !USE(GTK4)
     gtk_widget_class_set_accessible_role(widgetClass, ATK_ROLE_ALERT);
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to