[webkit-changes] [WebKit/WebKit] b00d19: [WebDriver][GLIB] Segfault with connection being c...

Lauro Moura noreply at github.com
Mon Sep 2 09:17:36 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b00d19a0d891f8ef7d31adf05f993848ec05d498
      https://github.com/WebKit/WebKit/commit/b00d19a0d891f8ef7d31adf05f993848ec05d498
  Author: Lauro Moura <lmoura at igalia.com>
  Date:   2024-09-02 (Mon, 02 Sep 2024)

  Changed paths:
    M Source/WebDriver/glib/SessionHostGlib.cpp

  Log Message:
  -----------
  [WebDriver][GLIB] Segfault with connection being closed by empty SetTargetList not related to disconnection
https://bugs.webkit.org/show_bug.cgi?id=278804

Reviewed by Carlos Garcia Campos.

282489 at main improved the teardown process for WebDriver sessions, but
assumed `SessionHostGlib.cpp` `setTargetList` would receive an empty
target list when the `RemoteInspector` requested `WebDriverService` to
disconnect.

But `setTargetList` might receive an empty list despite being still
connected, as the message handler callback filters non-Automation
targets out of the list before forwarding the list to the
`setTargetList` method.

For example, testing with GTK's MiniBrowser it always sends a first
listing of a single WebPage target before sending the Automation
target.

Assuming the connection had been disconnected, `SessionHostGlib` then
called `connectionDidClose`, leaving it in an inconsistent state when
the proper `Automation` target arrived in a following `setTargetList`
call, leading to segfaults.

This commit changes the behavior to call `connectionDidClose` for empty
lists _only_ when we already had received a valid Automation target before
and we're connected to it.

Also some drive-by cleanups, removing uneeded assertions already handled
by earlier checks and clarifying comments.

* Source/WebDriver/glib/SessionHostGlib.cpp:
(WebDriver::SessionHost::setTargetList):

Canonical link: https://commits.webkit.org/283061@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list