Title: [189001] branches/safari-601.1-branch
Revision
189001
Author
aes...@apple.com
Date
2015-08-26 16:36:58 -0700 (Wed, 26 Aug 2015)

Log Message

Merge r188988.

    2015-08-26  Andy Estes  <aes...@apple.com>

    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:

Modified Paths

Added Paths

Diff

Modified: branches/safari-601.1-branch/LayoutTests/ChangeLog (189000 => 189001)


--- branches/safari-601.1-branch/LayoutTests/ChangeLog	2015-08-26 23:21:47 UTC (rev 189000)
+++ branches/safari-601.1-branch/LayoutTests/ChangeLog	2015-08-26 23:36:58 UTC (rev 189001)
@@ -1,3 +1,22 @@
+2015-08-26  Andy Estes  <aes...@apple.com>
+
+        Merge r188988.
+
+    2015-08-26  Andy Estes  <aes...@apple.com>
+
+            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.
+
+            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:
+
 2015-08-21  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r188769. rdar://problem/22354983

Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentfiltering/load-substitute-data-from-appcache-expected.txt (0 => 189001)


--- branches/safari-601.1-branch/LayoutTests/http/tests/contentfiltering/load-substitute-data-from-appcache-expected.txt	                        (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentfiltering/load-substitute-data-from-appcache-expected.txt	2015-08-26 23:36:58 UTC (rev 189001)
@@ -0,0 +1,3 @@
+This is a regression test for webkit.org/b/147651. The test passes if it does not crash.
+
+

Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentfiltering/load-substitute-data-from-appcache.html (0 => 189001)


--- branches/safari-601.1-branch/LayoutTests/http/tests/contentfiltering/load-substitute-data-from-appcache.html	                        (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentfiltering/load-substitute-data-from-appcache.html	2015-08-26 23:36:58 UTC (rev 189001)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<script>
+if (window.internals) {
+    var settings = window.internals.mockContentFilterSettings;
+    settings.enabled = true;
+    settings.decisionPoint = settings.DECISION_POINT_AFTER_ADD_DATA;
+    settings.decision = settings.DECISION_ALLOW;
+}
+
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+    testRunner.setShouldDecideNavigationPolicyAfterDelay(true);
+}
+
+window.addEventListener("message", function() {
+    frames[0].location = "/resources/redirect.php?url=""
+});
+</script>
+<body>
+<p>This is a regression test for <a href="" The test passes if it does not crash.</p>
+<iframe src=""
+</body>
+</html>

Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentfiltering/resources/appcache.html (0 => 189001)


--- branches/safari-601.1-branch/LayoutTests/http/tests/contentfiltering/resources/appcache.html	                        (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentfiltering/resources/appcache.html	2015-08-26 23:36:58 UTC (rev 189001)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html manifest="appcache.manifest">
+<script>
+applicationCache._onnoupdate_ = function() {
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+applicationCache._oncached_ = function() {
+    parent.postMessage("cached", "*");
+}
+</script>
+</html>

Added: branches/safari-601.1-branch/LayoutTests/http/tests/contentfiltering/resources/appcache.manifest (0 => 189001)


--- branches/safari-601.1-branch/LayoutTests/http/tests/contentfiltering/resources/appcache.manifest	                        (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/http/tests/contentfiltering/resources/appcache.manifest	2015-08-26 23:36:58 UTC (rev 189001)
@@ -0,0 +1 @@
+CACHE MANIFEST

Modified: branches/safari-601.1-branch/LayoutTests/platform/mac-wk1/TestExpectations (189000 => 189001)


--- branches/safari-601.1-branch/LayoutTests/platform/mac-wk1/TestExpectations	2015-08-26 23:21:47 UTC (rev 189000)
+++ branches/safari-601.1-branch/LayoutTests/platform/mac-wk1/TestExpectations	2015-08-26 23:36:58 UTC (rev 189001)
@@ -126,3 +126,6 @@
 
 ### END OF (2) Failures without bug reports
 ########################################
+
+# This test is WebKit2-only
+http/tests/contentfiltering/load-substitute-data-from-appcache.html

Modified: branches/safari-601.1-branch/Tools/ChangeLog (189000 => 189001)


--- branches/safari-601.1-branch/Tools/ChangeLog	2015-08-26 23:21:47 UTC (rev 189000)
+++ branches/safari-601.1-branch/Tools/ChangeLog	2015-08-26 23:36:58 UTC (rev 189001)
@@ -1,3 +1,32 @@
+2015-08-26  Andy Estes  <aes...@apple.com>
+
+        Merge r188988.
+
+    2015-08-26  Andy Estes  <aes...@apple.com>
+
+            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.
+
+            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):
+
 2015-08-14  Babak Shafiei  <bshaf...@apple.com>
 
         Merge r188486.

Modified: branches/safari-601.1-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (189000 => 189001)


--- branches/safari-601.1-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2015-08-26 23:21:47 UTC (rev 189000)
+++ branches/safari-601.1-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2015-08-26 23:36:58 UTC (rev 189001)
@@ -75,6 +75,7 @@
     void setCacheModel(int model);
     void setAsynchronousSpellCheckingEnabled(boolean value);
     void setPrinting();
+    void setShouldDecideNavigationPolicyAfterDelay(boolean value);
 
     // Special DOM functions.
     void clearBackForwardList();

Modified: branches/safari-601.1-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (189000 => 189001)


--- branches/safari-601.1-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2015-08-26 23:21:47 UTC (rev 189000)
+++ branches/safari-601.1-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2015-08-26 23:36:58 UTC (rev 189001)
@@ -1286,6 +1286,9 @@
         injectedBundle.outputText(stringBuilder.toString());
     }
 
+    if (injectedBundle.testRunner()->shouldDecideNavigationPolicyAfterDelay())
+        return WKBundlePagePolicyActionPassThrough;
+
     if (!injectedBundle.testRunner()->isPolicyDelegateEnabled())
         return WKBundlePagePolicyActionUse;
 

Modified: branches/safari-601.1-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (189000 => 189001)


--- branches/safari-601.1-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2015-08-26 23:21:47 UTC (rev 189000)
+++ branches/safari-601.1-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2015-08-26 23:36:58 UTC (rev 189001)
@@ -851,4 +851,12 @@
     return JSC::setNeverInline(context, theFunction);
 }
 
+void TestRunner::setShouldDecideNavigationPolicyAfterDelay(bool value)
+{
+    m_shouldDecideNavigationPolicyAfterDelay = value;
+    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetShouldDecideNavigationPolicyAfterDelay"));
+    WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value));
+    WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
+}
+
 } // namespace WTR

Modified: branches/safari-601.1-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (189000 => 189001)


--- branches/safari-601.1-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2015-08-26 23:21:47 UTC (rev 189000)
+++ branches/safari-601.1-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2015-08-26 23:36:58 UTC (rev 189001)
@@ -281,6 +281,9 @@
     JSValueRef numberOfDFGCompiles(JSValueRef theFunction);
     JSValueRef neverInlineFunction(JSValueRef theFunction);
 
+    bool shouldDecideNavigationPolicyAfterDelay() const { return m_shouldDecideNavigationPolicyAfterDelay; }
+    void setShouldDecideNavigationPolicyAfterDelay(bool);
+
 private:
     TestRunner();
 
@@ -331,6 +334,8 @@
     double m_databaseDefaultQuota;
     double m_databaseMaxQuota;
 
+    bool m_shouldDecideNavigationPolicyAfterDelay { false };
+
     bool m_userStyleSheetEnabled;
     WKRetainPtr<WKStringRef> m_userStyleSheetLocation;
 

Modified: branches/safari-601.1-branch/Tools/WebKitTestRunner/TestController.cpp (189000 => 189001)


--- branches/safari-601.1-branch/Tools/WebKitTestRunner/TestController.cpp	2015-08-26 23:21:47 UTC (rev 189000)
+++ branches/safari-601.1-branch/Tools/WebKitTestRunner/TestController.cpp	2015-08-26 23:36:58 UTC (rev 189001)
@@ -55,6 +55,7 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <string>
+#include <wtf/RunLoop.h>
 #include <wtf/text/CString.h>
 
 #if PLATFORM(COCOA)
@@ -311,6 +312,8 @@
 
 void TestController::initialize(int argc, const char* argv[])
 {
+    RunLoop::initializeMainRunLoop();
+
     platformInitialize();
 
     Options options;
@@ -717,6 +720,8 @@
     // Reset main page back to about:blank
     m_doneResetting = false;
 
+    m_shouldDecideNavigationPolicyAfterDelay = false;
+
     WKPageLoadURL(m_mainWebView->page(), blankURL());
     runUntil(m_doneResetting, shortTimeout);
     return m_doneResetting;
@@ -1548,12 +1553,19 @@
 
 void TestController::decidePolicyForNavigationAction(WKFramePolicyListenerRef listener)
 {
-    if (m_policyDelegateEnabled && !m_policyDelegatePermissive) {
-        WKFramePolicyListenerIgnore(listener);
-        return;
-    }
+    WKRetainPtr<WKFramePolicyListenerRef> retainedListener { listener };
+    const bool shouldIgnore { m_policyDelegateEnabled && !m_policyDelegatePermissive };
+    std::function<void()> decisionFunction = [shouldIgnore, retainedListener]() {
+        if (shouldIgnore)
+            WKFramePolicyListenerIgnore(retainedListener.get());
+        else
+            WKFramePolicyListenerUse(retainedListener.get());
+    };
 
-    WKFramePolicyListenerUse(listener);
+    if (m_shouldDecideNavigationPolicyAfterDelay)
+        RunLoop::main().dispatch(decisionFunction);
+    else
+        decisionFunction();
 }
 
 void TestController::decidePolicyForNavigationResponse(WKPageRef, WKNavigationResponseRef navigationResponse, WKFramePolicyListenerRef listener, WKTypeRef, const void* clientInfo)

Modified: branches/safari-601.1-branch/Tools/WebKitTestRunner/TestController.h (189000 => 189001)


--- branches/safari-601.1-branch/Tools/WebKitTestRunner/TestController.h	2015-08-26 23:21:47 UTC (rev 189000)
+++ branches/safari-601.1-branch/Tools/WebKitTestRunner/TestController.h	2015-08-26 23:36:58 UTC (rev 189001)
@@ -121,6 +121,8 @@
 
     bool isCurrentInvocation(TestInvocation* invocation) const { return invocation == m_currentInvocation.get(); }
 
+    void setShouldDecideNavigationPolicyAfterDelay(bool value) { m_shouldDecideNavigationPolicyAfterDelay = value; }
+
 private:
     void initialize(int argc, const char* argv[]);
     void createWebViewWithOptions(WKDictionaryRef);
@@ -273,6 +275,8 @@
     bool m_shouldLogHistoryClientCallbacks;
     bool m_shouldShowWebView;
 
+    bool m_shouldDecideNavigationPolicyAfterDelay { false };
+
     std::unique_ptr<EventSenderProxy> m_eventSenderProxy;
 
     WorkQueueManager m_workQueueManager;

Modified: branches/safari-601.1-branch/Tools/WebKitTestRunner/TestInvocation.cpp (189000 => 189001)


--- branches/safari-601.1-branch/Tools/WebKitTestRunner/TestInvocation.cpp	2015-08-26 23:21:47 UTC (rev 189000)
+++ branches/safari-601.1-branch/Tools/WebKitTestRunner/TestInvocation.cpp	2015-08-26 23:36:58 UTC (rev 189001)
@@ -630,6 +630,13 @@
         return;
     }
 
+    if (WKStringIsEqualToUTF8CString(messageName, "SetShouldDecideNavigationPolicyAfterDelay")) {
+        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
+        WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
+        TestController::singleton().setShouldDecideNavigationPolicyAfterDelay(WKBooleanGetValue(value));
+        return;
+    }
+
     ASSERT_NOT_REACHED();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to