Title: [206132] trunk/Source
Revision
206132
Author
ander...@apple.com
Date
2016-09-19 16:46:59 -0700 (Mon, 19 Sep 2016)

Log Message

Suppress _javascript_ prompts early on in certain cases
https://bugs.webkit.org/show_bug.cgi?id=162243
rdar://problem/27661602

Reviewed by Geoffrey Garen.

Source/WebCore:

Export symbols needed by WebKit2.

* loader/FrameLoader.h:
* loader/FrameLoaderStateMachine.h:

Source/WebKit2:

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::shouldSuppressJavaScriptDialogs):
Add helper function.

(WebKit::WebChromeClient::runJavaScriptAlert):
(WebKit::WebChromeClient::runJavaScriptConfirm):
(WebKit::WebChromeClient::runJavaScriptPrompt):
Call helper function and return early if we should supress dialogs.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (206131 => 206132)


--- trunk/Source/WebCore/ChangeLog	2016-09-19 23:45:24 UTC (rev 206131)
+++ trunk/Source/WebCore/ChangeLog	2016-09-19 23:46:59 UTC (rev 206132)
@@ -1,3 +1,16 @@
+2016-09-19  Anders Carlsson  <ander...@apple.com>
+
+        Suppress _javascript_ prompts early on in certain cases
+        https://bugs.webkit.org/show_bug.cgi?id=162243
+        rdar://problem/27661602
+
+        Reviewed by Geoffrey Garen.
+
+        Export symbols needed by WebKit2.
+
+        * loader/FrameLoader.h:
+        * loader/FrameLoaderStateMachine.h:
+
 2016-09-19  Chris Dumez  <cdu...@apple.com>
 
         Align HTMLAppletElement with the specification

Modified: trunk/Source/WebCore/loader/FrameLoader.h (206131 => 206132)


--- trunk/Source/WebCore/loader/FrameLoader.h	2016-09-19 23:45:24 UTC (rev 206131)
+++ trunk/Source/WebCore/loader/FrameLoader.h	2016-09-19 23:46:59 UTC (rev 206132)
@@ -231,7 +231,7 @@
 
     bool checkIfFormActionAllowedByCSP(const URL&, bool didReceiveRedirectResponse) const;
 
-    Frame* opener();
+    WEBCORE_EXPORT Frame* opener();
     WEBCORE_EXPORT void setOpener(Frame*);
 
     void resetMultipleFormSubmissionProtection();

Modified: trunk/Source/WebCore/loader/FrameLoaderStateMachine.h (206131 => 206132)


--- trunk/Source/WebCore/loader/FrameLoaderStateMachine.h	2016-09-19 23:45:24 UTC (rev 206131)
+++ trunk/Source/WebCore/loader/FrameLoaderStateMachine.h	2016-09-19 23:46:59 UTC (rev 206132)
@@ -55,7 +55,7 @@
     WEBCORE_EXPORT bool committingFirstRealLoad() const;
     bool committedFirstRealDocumentLoad() const;
     bool creatingInitialEmptyDocument() const;
-    bool isDisplayingInitialEmptyDocument() const;
+    WEBCORE_EXPORT bool isDisplayingInitialEmptyDocument() const;
     WEBCORE_EXPORT bool firstLayoutDone() const;
     void advanceTo(State);
 

Modified: trunk/Source/WebKit2/ChangeLog (206131 => 206132)


--- trunk/Source/WebKit2/ChangeLog	2016-09-19 23:45:24 UTC (rev 206131)
+++ trunk/Source/WebKit2/ChangeLog	2016-09-19 23:46:59 UTC (rev 206132)
@@ -1,3 +1,20 @@
+2016-09-19  Anders Carlsson  <ander...@apple.com>
+
+        Suppress _javascript_ prompts early on in certain cases
+        https://bugs.webkit.org/show_bug.cgi?id=162243
+        rdar://problem/27661602
+
+        Reviewed by Geoffrey Garen.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::shouldSuppressJavaScriptDialogs):
+        Add helper function.
+
+        (WebKit::WebChromeClient::runJavaScriptAlert):
+        (WebKit::WebChromeClient::runJavaScriptConfirm):
+        (WebKit::WebChromeClient::runJavaScriptPrompt):
+        Call helper function and return early if we should supress dialogs.
+
 2016-09-19  Keith Rollin  <krol...@apple.com>
 
         Reduce logging from WebResourceLoader::didReceiveData

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (206131 => 206132)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2016-09-19 23:45:24 UTC (rev 206131)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2016-09-19 23:46:59 UTC (rev 206132)
@@ -379,8 +379,19 @@
     m_page->sendClose();
 }
 
+static bool shouldSuppressJavaScriptDialogs(Frame& frame)
+{
+    if (frame.loader().opener() && frame.loader().stateMachine().isDisplayingInitialEmptyDocument() && frame.loader().provisionalDocumentLoader())
+        return true;
+
+    return false;
+}
+
 void WebChromeClient::runJavaScriptAlert(Frame* frame, const String& alertText)
 {
+    if (shouldSuppressJavaScriptDialogs(*frame))
+        return;
+
     WebFrame* webFrame = WebFrame::fromCoreFrame(*frame);
     ASSERT(webFrame);
 
@@ -394,6 +405,9 @@
 
 bool WebChromeClient::runJavaScriptConfirm(Frame* frame, const String& message)
 {
+    if (shouldSuppressJavaScriptDialogs(*frame))
+        return false;
+
     WebFrame* webFrame = WebFrame::fromCoreFrame(*frame);
     ASSERT(webFrame);
 
@@ -411,6 +425,9 @@
 
 bool WebChromeClient::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result)
 {
+    if (shouldSuppressJavaScriptDialogs(*frame))
+        return false;
+
     WebFrame* webFrame = WebFrame::fromCoreFrame(*frame);
     ASSERT(webFrame);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to