Repro crash at www.sears.com (infinite recursion in beforeunload handler)
<rdar://problem/7965182> and https://bugs.webkit.org/show_bug.cgi?id=38928

Reviewed by Darin Adler.

WebCore: 

Test: fast/loader/recursive-before-unload-crash.html

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::shouldClose): Copied from Frame, with the pageDismissal flag set.
* loader/FrameLoader.h:

* page/Frame.cpp:
(WebCore::Frame::shouldClose): Forward to the new FrameLoader::shouldClose().
* page/Frame.h:
(WebCore::Frame::existingDOMWindow):

LayoutTests: 

* fast/loader/recursive-before-unload-crash-expected.txt: Added.
* fast/loader/recursive-before-unload-crash.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@59384 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h
index b518bee..e0ebf4d 100644
--- a/WebCore/loader/FrameLoader.h
+++ b/WebCore/loader/FrameLoader.h
@@ -351,6 +351,8 @@
 
     void clear(bool clearWindowProperties = true, bool clearScriptObjects = true, bool clearFrameView = true);
     
+    bool shouldClose();
+
 private:
     bool canCachePageContainingThisFrame();
 #ifndef NDEBUG