Changeset 188988 in webkit


Ignore:
Timestamp:
Aug 26, 2015 2:15:49 PM (9 years ago)
Author:
aestes@apple.com
Message:

Crash when following a Google search link to Twitter with Limit Adult Content enabled
https://bugs.webkit.org/show_bug.cgi?id=147651

Rubber-stamped by Brady Eidson.

Tools:

Taught TestRunner how to decide the navigation policy after a delay.

  • WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:

(WTR::InjectedBundlePage::decidePolicyForNavigationAction):

  • WebKitTestRunner/InjectedBundle/TestRunner.cpp:

(WTR::TestRunner::setShouldDecideNavigationPolicyAfterDelay):

  • WebKitTestRunner/InjectedBundle/TestRunner.h:

(WTR::TestRunner::shouldDecideNavigationPolicyAfterDelay):

  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::initialize):
(WTR::TestController::resetStateToConsistentValues):
(WTR::TestController::decidePolicyForNavigationAction):

  • WebKitTestRunner/TestController.h:

(WTR::TestController::setShouldDecideNavigationPolicyAfterDelay):

  • WebKitTestRunner/TestInvocation.cpp:

(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):

LayoutTests:

Added a layout test.

  • http/tests/contentfiltering/load-substitute-data-from-appcache-expected.txt: Added.
  • http/tests/contentfiltering/load-substitute-data-from-appcache.html: Added.
  • http/tests/contentfiltering/resources/appcache.html: Added.
  • http/tests/contentfiltering/resources/appcache.manifest: Added.
  • platform/mac-wk1/TestExpectations:
Location:
trunk
Files:
4 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r188971 r188988  
     12015-08-26  Andy Estes  <aestes@apple.com>
     2
     3        Crash when following a Google search link to Twitter with Limit Adult Content enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=147651
     5
     6        Rubber-stamped by Brady Eidson.
     7
     8        Added a layout test.
     9
     10        * http/tests/contentfiltering/load-substitute-data-from-appcache-expected.txt: Added.
     11        * http/tests/contentfiltering/load-substitute-data-from-appcache.html: Added.
     12        * http/tests/contentfiltering/resources/appcache.html: Added.
     13        * http/tests/contentfiltering/resources/appcache.manifest: Added.
     14        * platform/mac-wk1/TestExpectations:
     15
    1162015-08-26  Tim Horton  <timothy_horton@apple.com>
    217
  • trunk/LayoutTests/platform/mac-wk1/TestExpectations

    r188793 r188988  
    142142### END OF (2) Failures without bug reports
    143143########################################
     144
     145# This test is WebKit2-only
     146http/tests/contentfiltering/load-substitute-data-from-appcache.html
  • trunk/Tools/ChangeLog

    r188982 r188988  
     12015-08-26  Andy Estes  <aestes@apple.com>
     2
     3        Crash when following a Google search link to Twitter with Limit Adult Content enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=147651
     5
     6        Rubber-stamped by Brady Eidson.
     7
     8        Taught TestRunner how to decide the navigation policy after a delay.
     9
     10        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
     11        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
     12        (WTR::InjectedBundlePage::decidePolicyForNavigationAction):
     13        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     14        (WTR::TestRunner::setShouldDecideNavigationPolicyAfterDelay):
     15        * WebKitTestRunner/InjectedBundle/TestRunner.h:
     16        (WTR::TestRunner::shouldDecideNavigationPolicyAfterDelay):
     17        * WebKitTestRunner/TestController.cpp:
     18        (WTR::TestController::initialize):
     19        (WTR::TestController::resetStateToConsistentValues):
     20        (WTR::TestController::decidePolicyForNavigationAction):
     21        * WebKitTestRunner/TestController.h:
     22        (WTR::TestController::setShouldDecideNavigationPolicyAfterDelay):
     23        * WebKitTestRunner/TestInvocation.cpp:
     24        (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
     25
    1262015-08-26  Brent Fulgham  <bfulgham@apple.com>
    227
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl

    r188598 r188988  
    7676    void setAsynchronousSpellCheckingEnabled(boolean value);
    7777    void setPrinting();
     78    void setShouldDecideNavigationPolicyAfterDelay(boolean value);
    7879
    7980    // Special DOM functions.
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r186982 r188988  
    12871287    }
    12881288
     1289    if (injectedBundle.testRunner()->shouldDecideNavigationPolicyAfterDelay())
     1290        return WKBundlePagePolicyActionPassThrough;
     1291
    12891292    if (!injectedBundle.testRunner()->isPolicyDelegateEnabled())
    12901293        return WKBundlePagePolicyActionUse;
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

    r188828 r188988  
    853853}
    854854
     855void TestRunner::setShouldDecideNavigationPolicyAfterDelay(bool value)
     856{
     857    m_shouldDecideNavigationPolicyAfterDelay = value;
     858    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetShouldDecideNavigationPolicyAfterDelay"));
     859    WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value));
     860    WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
     861}
     862
    855863} // namespace WTR
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

    r188598 r188988  
    284284    JSValueRef neverInlineFunction(JSValueRef theFunction);
    285285
     286    bool shouldDecideNavigationPolicyAfterDelay() const { return m_shouldDecideNavigationPolicyAfterDelay; }
     287    void setShouldDecideNavigationPolicyAfterDelay(bool);
     288
    286289private:
    287290    TestRunner();
     
    334337    double m_databaseMaxQuota;
    335338
     339    bool m_shouldDecideNavigationPolicyAfterDelay { false };
     340
    336341    bool m_userStyleSheetEnabled;
    337342    WKRetainPtr<WKStringRef> m_userStyleSheetLocation;
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r188958 r188988  
    5757#include <stdlib.h>
    5858#include <string>
     59#include <wtf/RunLoop.h>
    5960#include <wtf/text/CString.h>
    6061
     
    313314void TestController::initialize(int argc, const char* argv[])
    314315{
     316    RunLoop::initializeMainRunLoop();
     317
    315318    platformInitialize();
    316319
     
    725728    m_doneResetting = false;
    726729
     730    m_shouldDecideNavigationPolicyAfterDelay = false;
     731
    727732    WKPageLoadURL(m_mainWebView->page(), blankURL());
    728733    runUntil(m_doneResetting, shortTimeout);
     
    14941499void TestController::decidePolicyForNavigationAction(WKFramePolicyListenerRef listener)
    14951500{
    1496     if (m_policyDelegateEnabled && !m_policyDelegatePermissive) {
    1497         WKFramePolicyListenerIgnore(listener);
    1498         return;
    1499     }
    1500 
    1501     WKFramePolicyListenerUse(listener);
     1501    WKRetainPtr<WKFramePolicyListenerRef> retainedListener { listener };
     1502    const bool shouldIgnore { m_policyDelegateEnabled && !m_policyDelegatePermissive };
     1503    std::function<void()> decisionFunction = [shouldIgnore, retainedListener]() {
     1504        if (shouldIgnore)
     1505            WKFramePolicyListenerIgnore(retainedListener.get());
     1506        else
     1507            WKFramePolicyListenerUse(retainedListener.get());
     1508    };
     1509
     1510    if (m_shouldDecideNavigationPolicyAfterDelay)
     1511        RunLoop::main().dispatch(decisionFunction);
     1512    else
     1513        decisionFunction();
    15021514}
    15031515
  • trunk/Tools/WebKitTestRunner/TestController.h

    r188828 r188988  
    125125    bool isCurrentInvocation(TestInvocation* invocation) const { return invocation == m_currentInvocation.get(); }
    126126
     127    void setShouldDecideNavigationPolicyAfterDelay(bool value) { m_shouldDecideNavigationPolicyAfterDelay = value; }
     128
    127129private:
    128130    void initialize(int argc, const char* argv[]);
     
    286288    bool m_shouldShowWebView;
    287289
     290    bool m_shouldDecideNavigationPolicyAfterDelay { false };
     291
    288292    std::unique_ptr<EventSenderProxy> m_eventSenderProxy;
    289293
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r188828 r188988  
    629629    }
    630630
     631    if (WKStringIsEqualToUTF8CString(messageName, "SetShouldDecideNavigationPolicyAfterDelay")) {
     632        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
     633        WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
     634        TestController::singleton().setShouldDecideNavigationPolicyAfterDelay(WKBooleanGetValue(value));
     635        return;
     636    }
     637
    631638    ASSERT_NOT_REACHED();
    632639}
Note: See TracChangeset for help on using the changeset viewer.