<?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>291217</bug_id>
          
          <creation_ts>2025-04-07 12:19:02 -0700</creation_ts>
          <short_desc>REGRESSION(292977@main): [Win] nested tasks are not dispatched</short_desc>
          <delta_ts>2025-04-07 23:23:18 -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>Platform</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows 11</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=284823</see_also>
          <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="Yury Semikhatsky">yurys</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>dpino</cc>
    
    <cc>fujii</cc>
    
    <cc>ian.grunert</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2109490</commentid>
    <comment_count>0</comment_count>
    <who name="Yury Semikhatsky">yurys</who>
    <bug_when>2025-04-07 12:19:02 -0700</bug_when>
    <thetext>After https://commits.webkit.org/292977@main nested tasks on main thread are not dispatched. 

Try inserting the following code somewhere in the UI process, e.g. in `WebPageInspectorController` constructor. `step 2 callback` is printed, but `step 3 callback` is not.

```
fprintf(stderr, &quot;step 1\n&quot;);
RunLoop::main().dispatch([] {
    fprintf(stderr, &quot;step 2 callback\n&quot;);
    RunLoop::main().dispatchAfter(Seconds(0.1), [] {
        fprintf(stderr, &quot;step 3 callback\n&quot;);
    });
});
```

It broke Playwright screencast and video recording functionality.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2109525</commentid>
    <comment_count>1</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2025-04-07 14:19:06 -0700</bug_when>
    <thetext>The run loop of UI process main thread is run by the application, not by WTF::RunLoop::run.
https://github.com/WebKit/WebKit/blob/2bebfdc1ea6d02362f3b549004940f2ef8ea28e2/Tools/MiniBrowser/win/WinMain.cpp#L81-L91

I think we should revert 292977@main.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2109526</commentid>
    <comment_count>2</comment_count>
      <attachid>474861</attachid>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2025-04-07 14:19:51 -0700</bug_when>
    <thetext>Created attachment 474861
test patch for MiniBrowser</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2109531</commentid>
    <comment_count>3</comment_count>
    <who name="Ian Grunert">ian.grunert</who>
    <bug_when>2025-04-07 14:33:01 -0700</bug_when>
    <thetext>Yeah, this used to work because the main thread&apos;s run loop and the WTF run loop both processed the WM_TIMER messages.

Agree we should revert for now. We might be able to do something similar to PlayStation&apos;s MiniBrowser and use the WTF run loop in MiniBrowser, but I&apos;d rather revert and we can land that later.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2109547</commentid>
    <comment_count>4</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2025-04-07 14:47:06 -0700</bug_when>
    <thetext>(In reply to Ian Grunert from comment #3)
&gt; Agree we should revert for now. We might be able to do something similar to
&gt; PlayStation&apos;s MiniBrowser and use the WTF run loop in MiniBrowser, but I&apos;d
&gt; rather revert and we can land that later.

The run loop is a bit customized.
https://github.com/WebKit/WebKit/blob/2bebfdc1ea6d02362f3b549004940f2ef8ea28e2/Tools/MiniBrowser/win/WinMain.cpp#L85-L86

Another customize is needed if we add a modeless dialog.
https://learn.microsoft.com/en-us/windows/win32/dlgbox/using-dialog-boxes#creating-a-modeless-dialog-box</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2109548</commentid>
    <comment_count>5</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2025-04-07 14:47:16 -0700</bug_when>
    <thetext>293380@main reverted 292977@main.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2109549</commentid>
    <comment_count>6</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-04-07 14:48:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/148773454&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>474861</attachid>
            <date>2025-04-07 14:19:51 -0700</date>
            <delta_ts>2025-04-07 14:19:51 -0700</delta_ts>
            <desc>test patch for MiniBrowser</desc>
            <filename>t.patch</filename>
            <type>text/plain</type>
            <size>734</size>
            <attacher name="Fujii Hironori">fujii</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJLaXQvVUlQcm9jZXNzL3dpbi9XZWJWaWV3LmNwcCBiL1Nv
dXJjZS9XZWJLaXQvVUlQcm9jZXNzL3dpbi9XZWJWaWV3LmNwcA0KaW5kZXggNTE4MGRhM2VjMjJk
Li41ZjgwYTJiYzk4NWYgMTAwNjQ0DQotLS0gYS9Tb3VyY2UvV2ViS2l0L1VJUHJvY2Vzcy93aW4v
V2ViVmlldy5jcHANCisrKyBiL1NvdXJjZS9XZWJLaXQvVUlQcm9jZXNzL3dpbi9XZWJWaWV3LmNw
cA0KQEAgLTM4Niw2ICszODYsMTQgQEAgTFJFU1VMVCBXZWJWaWV3OjpvbldoZWVsRXZlbnQoSFdO
RCBoV25kLCBVSU5UIG1lc3NhZ2UsIFdQQVJBTSB3UGFyYW0sIExQQVJBTSBsUGENCiANCiAgICAg
bV9wYWdlLT5oYW5kbGVOYXRpdmVXaGVlbEV2ZW50KHdoZWVsRXZlbnQpOw0KIA0KKyAgICBBTFdB
WVNfTE9HX1dJVEhfU1RSRUFNKHN0cmVhbSA8PCAic3RlcCAxIik7DQorICAgIFJ1bkxvb3A6Om1h
aW4oKS5kaXNwYXRjaChbXSB7DQorICAgICAgICBBTFdBWVNfTE9HX1dJVEhfU1RSRUFNKHN0cmVh
bSA8PCAic3RlcCAyIGNhbGxiYWNrIik7DQorICAgICAgICBSdW5Mb29wOjptYWluKCkuZGlzcGF0
Y2hBZnRlcihTZWNvbmRzKDAuMSksIFtdIHsNCisgICAgICAgICAgICBBTFdBWVNfTE9HX1dJVEhf
U1RSRUFNKHN0cmVhbSA8PCAic3RlcCAzIGNhbGxiYWNrIik7DQorICAgICAgICB9KTsNCisgICAg
fSk7DQorDQogICAgIGhhbmRsZWQgPSB0cnVlOw0KICAgICByZXR1cm4gMDsNCiB9DQo=
</data>

          </attachment>
      

    </bug>

</bugzilla>