Changeset 206132 in webkit


Ignore:
Timestamp:
Sep 19, 2016, 4:46:59 PM (9 years ago)
Author:
andersca@apple.com
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.

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r206131 r206132  
     12016-09-19  Anders Carlsson  <andersca@apple.com>
     2
     3        Suppress JavaScript prompts early on in certain cases
     4        https://bugs.webkit.org/show_bug.cgi?id=162243
     5        rdar://problem/27661602
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        Export symbols needed by WebKit2.
     10
     11        * loader/FrameLoader.h:
     12        * loader/FrameLoaderStateMachine.h:
     13
    1142016-09-19  Chris Dumez  <cdumez@apple.com>
    215
  • trunk/Source/WebCore/loader/FrameLoader.h

    r206006 r206132  
    232232    bool checkIfFormActionAllowedByCSP(const URL&, bool didReceiveRedirectResponse) const;
    233233
    234     Frame* opener();
     234    WEBCORE_EXPORT Frame* opener();
    235235    WEBCORE_EXPORT void setOpener(Frame*);
    236236
  • trunk/Source/WebCore/loader/FrameLoaderStateMachine.h

    r186894 r206132  
    5656    bool committedFirstRealDocumentLoad() const;
    5757    bool creatingInitialEmptyDocument() const;
    58     bool isDisplayingInitialEmptyDocument() const;
     58    WEBCORE_EXPORT bool isDisplayingInitialEmptyDocument() const;
    5959    WEBCORE_EXPORT bool firstLayoutDone() const;
    6060    void advanceTo(State);
  • trunk/Source/WebKit2/ChangeLog

    r206123 r206132  
     12016-09-19  Anders Carlsson  <andersca@apple.com>
     2
     3        Suppress JavaScript prompts early on in certain cases
     4        https://bugs.webkit.org/show_bug.cgi?id=162243
     5        rdar://problem/27661602
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     10        (WebKit::shouldSuppressJavaScriptDialogs):
     11        Add helper function.
     12
     13        (WebKit::WebChromeClient::runJavaScriptAlert):
     14        (WebKit::WebChromeClient::runJavaScriptConfirm):
     15        (WebKit::WebChromeClient::runJavaScriptPrompt):
     16        Call helper function and return early if we should supress dialogs.
     17
    1182016-09-19  Keith Rollin  <krollin@apple.com>
    219
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r205537 r206132  
    380380}
    381381
     382static bool shouldSuppressJavaScriptDialogs(Frame& frame)
     383{
     384    if (frame.loader().opener() && frame.loader().stateMachine().isDisplayingInitialEmptyDocument() && frame.loader().provisionalDocumentLoader())
     385        return true;
     386
     387    return false;
     388}
     389
    382390void WebChromeClient::runJavaScriptAlert(Frame* frame, const String& alertText)
    383391{
     392    if (shouldSuppressJavaScriptDialogs(*frame))
     393        return;
     394
    384395    WebFrame* webFrame = WebFrame::fromCoreFrame(*frame);
    385396    ASSERT(webFrame);
     
    395406bool WebChromeClient::runJavaScriptConfirm(Frame* frame, const String& message)
    396407{
     408    if (shouldSuppressJavaScriptDialogs(*frame))
     409        return false;
     410
    397411    WebFrame* webFrame = WebFrame::fromCoreFrame(*frame);
    398412    ASSERT(webFrame);
     
    412426bool WebChromeClient::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result)
    413427{
     428    if (shouldSuppressJavaScriptDialogs(*frame))
     429        return false;
     430
    414431    WebFrame* webFrame = WebFrame::fromCoreFrame(*frame);
    415432    ASSERT(webFrame);
Note: See TracChangeset for help on using the changeset viewer.