[Webkit-unassigned] [Bug 235322] New: Adding iframe flushes microtasks synchronously with dirty stack
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Jan 18 10:23:06 PST 2022
https://bugs.webkit.org/show_bug.cgi?id=235322
Bug ID: 235322
Summary: Adding iframe flushes microtasks synchronously with
dirty stack
Product: WebKit
Version: Safari 15
Hardware: All
OS: All
Status: NEW
Severity: Normal
Priority: P2
Component: JavaScriptCore
Assignee: webkit-unassigned at lists.webkit.org
Reporter: dan.abramov at gmail.com
Created attachment 449401
--> https://bugs.webkit.org/attachment.cgi?id=449401&action=review
repro
Microtasks are supposed to run on a clean stack. However, Safari flushes microtasks synchronously if you append an iframe to the page. This breaks expectations for libraries like React/Preact, and possibly others:
- https://github.com/facebook/react/issues/22459
- https://github.com/preactjs/preact/issues/2814
Here is a simple repro:
```
queueMicrotask(() => {
console.log("--- in microtask ---");
});
console.log("will add iframe");
const iframe = document.createElement("iframe");
iframe.src = "localhost";
document.body.appendChild(iframe);
console.log("did add iframe");
```
You need to run it with http server to repro. It doesn't repro from file://.
Expected output:
```
will add iframe
did add iframe
--- in microtask ---
```
Safari output:
```
will add iframe
--- in microtask ---
did add iframe
```
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220118/f6192362/attachment.htm>
More information about the webkit-unassigned
mailing list