Ignore-opens-during-unload counter of a parent should apply to its children during beforeunload event
https://bugs.webkit.org/show_bug.cgi?id=189376
<rdar://problem/44282754>

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline existing test now that one more check is passing.

* web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/ignore-opens-during-unload.window-expected.txt:

Source/WebCore:

Make sure the Ignore-opens-during-unload counter of a parent stays incremented while we are firing the
beforeunload event for its descendants, as per:
- https://html.spec.whatwg.org/multipage/browsing-the-web.html#prompt-to-unload-a-document

No new tests, rebaselined existing tests.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::shouldClose):
(WebCore::FrameLoader::dispatchBeforeUnloadEvent):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@236517 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
index e76d0db..a91f6bd 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -3122,6 +3122,7 @@
     bool shouldClose = false;
     {
         NavigationDisabler navigationDisabler(&m_frame);
+        IgnoreOpensDuringUnloadCountIncrementer ignoreOpensDuringUnloadCountIncrementer(m_frame.document());
         size_t i;
 
         for (i = 0; i < targetFrames.size(); i++) {
@@ -3229,7 +3230,6 @@
 
     {
         ForbidPromptsScope forbidPrompts(m_frame.page());
-        IgnoreOpensDuringUnloadCountIncrementer ignoreOpensDuringUnloadCountIncrementer(m_frame.document());
         domWindow->dispatchEvent(beforeUnloadEvent, domWindow->document());
     }