Per https://html.spec.whatwg.org/multipage/browsing-the-web.html#prompt-to-unload-a-document, the ignore-opens-during-unload counter of the document on which "prompt to unload" is called should stay incremented even as its descendants are being prompted for unload. This is the behavior of Firefox as well as Chrome 70+. Test is available at https://github.com/web-platform-tests/wpt/blob/master/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/ignore-opens-during-unload.window.js. In particular, the "document.open should bail out when ignore-opens-during-unload is greater than 0 during beforeunload event (open(parent) while unloading parent and child)" test currently fails.
<rdar://problem/44282754>
Created attachment 350870 [details] Patch
Comment on attachment 350870 [details] Patch Clearing flags on attachment: 350870 Committed r236517: <https://trac.webkit.org/changeset/236517>
All reviewed patches have been landed. Closing bug.