<?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>205069</bug_id>
          
          <creation_ts>2019-12-10 09:57:04 -0800</creation_ts>
          <short_desc>There should be no user-noticeable delay when closing a tab</short_desc>
          <delta_ts>2019-12-11 20:55:33 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit2</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>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Chris Dumez">cdumez</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>ggaren</cc>
    
    <cc>mitz</cc>
    
    <cc>rniwa</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1597225</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2019-12-10 09:57:04 -0800</bug_when>
    <thetext>There should be no user-noticeable delay when closing a tab. To achieve this, use a timeout of 50ms for doing the IPC handshake with the WebContent process, instead of 500ms.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1597226</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2019-12-10 09:57:50 -0800</bug_when>
    <thetext>&lt;rdar://problem/57797494&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1597231</commentid>
    <comment_count>2</comment_count>
      <attachid>385276</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2019-12-10 10:00:50 -0800</bug_when>
    <thetext>Created attachment 385276
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1597629</commentid>
    <comment_count>3</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2019-12-11 08:30:25 -0800</bug_when>
    <thetext>ping review?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1597781</commentid>
    <comment_count>4</comment_count>
      <attachid>385276</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2019-12-11 14:05:28 -0800</bug_when>
    <thetext>Comment on attachment 385276
Patch

Clearing flags on attachment: 385276

Committed r253395: &lt;https://trac.webkit.org/changeset/253395&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1597782</commentid>
    <comment_count>5</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2019-12-11 14:05:30 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1597909</commentid>
    <comment_count>6</comment_count>
    <who name="">mitz</who>
    <bug_when>2019-12-11 18:36:11 -0800</bug_when>
    <thetext>What’s the user-visible symptom when the UI process misses the 50ms deadline? Can you share any field data on how often it would happen?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1597912</commentid>
    <comment_count>7</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2019-12-11 19:06:26 -0800</bug_when>
    <thetext>(In reply to mitz from comment #6)
&gt; What’s the user-visible symptom when the UI process misses the 50ms
&gt; deadline? Can you share any field data on how often it would happen?

It would not be the UIProcess missing the deadline but rather the WebProcess missing the deadline. From the UIProcess point of view, after 50ms we close the tab no matter what, even if the page’s script is still handling the beforeunload event.

The idea is that we give the page’s script a chance to tell us if we should display an unload confirm prompt but not at the cost of a delaying the tab closing for more than 50ms. The script has 50ms to tell us to show the prompt or we close the tab without showing such prompts.

I do not have data on how common this will happen in practice. However, there is error logging in release builds if it happens. Also, from my own personal experience unload confirm prompt are not very common on the Web.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1597926</commentid>
    <comment_count>8</comment_count>
    <who name="">mitz</who>
    <bug_when>2019-12-11 20:55:33 -0800</bug_when>
    <thetext>(In reply to Chris Dumez from comment #7)

Thanks for the detailed response, Chris!

&gt; (In reply to mitz from comment #6)
&gt; &gt; What’s the user-visible symptom when the UI process misses the 50ms
&gt; &gt; deadline? Can you share any field data on how often it would happen?
&gt; 
&gt; It would not be the UIProcess missing the deadline but rather the WebProcess
&gt; missing the deadline.

Sorry, my silly mistake.

&gt; From the UIProcess point of view, after 50ms we close
&gt; the tab no matter what, even if the page’s script is still handling the
&gt; beforeunload event.
&gt; 
&gt; The idea is that we give the page’s script a chance to tell us if we should
&gt; display an unload confirm prompt but not at the cost of a delaying the tab
&gt; closing for more than 50ms. The script has 50ms to tell us to show the
&gt; prompt or we close the tab without showing such prompts.

Makes sense.

&gt; I do not have data on how common this will happen in practice. However,
&gt; there is error logging in release builds if it happens. Also, from my own
&gt; personal experience unload confirm prompt are not very common on the Web.

I also rarely get prompted on close (even with the current 500ms delay).</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>385276</attachid>
            <date>2019-12-10 10:00:50 -0800</date>
            <delta_ts>2019-12-11 14:05:28 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-205069-20191210100050.patch</filename>
            <type>text/plain</type>
            <size>1608</size>
            <attacher name="Chris Dumez">cdumez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjUzMzI4CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViS2l0L0No
YW5nZUxvZyBiL1NvdXJjZS9XZW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