<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>256506</bug_id>
          
          <creation_ts>2023-05-08 20:22:21 -0700</creation_ts>
          <short_desc>[WPE] Make MiniBrowser quit upon last WebView closed</short_desc>
          <delta_ts>2023-05-09 07:46:35 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WPE WebKit</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Lauro Moura">lmoura</reporter>
          <assigned_to name="Lauro Moura">lmoura</assigned_to>
          <cc>bugs-noreply</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1953930</commentid>
    <comment_count>0</comment_count>
    <who name="Lauro Moura">lmoura</who>
    <bug_when>2023-05-08 20:22:21 -0700</bug_when>
    <thetext>In WebDriver tests, sometimes the last visible window is closed by issuing the &quot;Delete Session&quot;[1] when leaving the test fixture. This makes the MiniBrowser&apos;s &quot;webViewClose&quot; callback to be called, which currently[2] only removes the target webview from the table of currently open webviews. This behavior might leave the browser in a state where there&apos;s no open windows, but the application is still alive.

In some WebDriver tests, this seems to make the WPEWebDriver&apos;s Session think there is still an AutomationSession alive on the other side and send commands to it, leading the issued commands to hang. More specifically, when closing the browsing contexts[3], if a connection is still &quot;alive&quot;, it&apos;ll try to issue getWindowHandles[3] on a deleted session as part of the &quot;close-window&quot; algorithm, it seems.

Note: There is another deadlock issue in selenium related to its webserver using non-daemon threads, which should be fixed by bumping - in a separate bug -the imported suite to include an upstream workaround[4].

Patch for both cases are on the way.

[1] https://www.w3.org/TR/webdriver/#delete-session
[2] https://github.com/WebKit/WebKit/blob/dfd1f46364b965f5c2a578e8375a2709e8c6a55f/Tools/MiniBrowser/wpe/main.cpp#L159
[3] https://github.com/WebKit/WebKit/blob/dfd1f46364b965f5c2a578e8375a2709e8c6a55f/Source/WebDriver/Session.cpp#L534
[4] https://github.com/SeleniumHQ/selenium/commit/d6d672cd93c5cfe57e84c0b17d907bdfd7a3ea2a</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1953932</commentid>
    <comment_count>1</comment_count>
    <who name="Lauro Moura">lmoura</who>
    <bug_when>2023-05-08 20:26:10 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/13622</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1954037</commentid>
    <comment_count>2</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-05-09 07:46:32 -0700</bug_when>
    <thetext>Committed 263864@main (88bec55a6d84): &lt;https://commits.webkit.org/263864@main&gt;

Reviewed commits have been landed. Closing PR #13622 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>