<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[189099] branches/safari-601.1.46-branch</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/189099">189099</a></dd>
<dt>Author</dt> <dd>aestes@apple.com</dd>
<dt>Date</dt> <dd>2015-08-28 09:40:46 -0700 (Fri, 28 Aug 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/188988">r188988</a>.

    2015-08-26  Andy Estes  &lt;aestes@apple.com&gt;

    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:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari601146branchLayoutTestsChangeLog">branches/safari-601.1.46-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari601146branchLayoutTestsplatformmacwk1TestExpectations">branches/safari-601.1.46-branch/LayoutTests/platform/mac-wk1/TestExpectations</a></li>
<li><a href="#branchessafari601146branchToolsChangeLog">branches/safari-601.1.46-branch/Tools/ChangeLog</a></li>
<li><a href="#branchessafari601146branchToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl">branches/safari-601.1.46-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl</a></li>
<li><a href="#branchessafari601146branchToolsWebKitTestRunnerInjectedBundleInjectedBundlePagecpp">branches/safari-601.1.46-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp</a></li>
<li><a href="#branchessafari601146branchToolsWebKitTestRunnerInjectedBundleTestRunnercpp">branches/safari-601.1.46-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp</a></li>
<li><a href="#branchessafari601146branchToolsWebKitTestRunnerInjectedBundleTestRunnerh">branches/safari-601.1.46-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h</a></li>
<li><a href="#branchessafari601146branchToolsWebKitTestRunnerTestControllercpp">branches/safari-601.1.46-branch/Tools/WebKitTestRunner/TestController.cpp</a></li>
<li><a href="#branchessafari601146branchToolsWebKitTestRunnerTestControllerh">branches/safari-601.1.46-branch/Tools/WebKitTestRunner/TestController.h</a></li>
<li><a href="#branchessafari601146branchToolsWebKitTestRunnerTestInvocationcpp">branches/safari-601.1.46-branch/Tools/WebKitTestRunner/TestInvocation.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari601146branchLayoutTestshttptestscontentfilteringloadsubstitutedatafromappcacheexpectedtxt">branches/safari-601.1.46-branch/LayoutTests/http/tests/contentfiltering/load-substitute-data-from-appcache-expected.txt</a></li>
<li><a href="#branchessafari601146branchLayoutTestshttptestscontentfilteringloadsubstitutedatafromappcachehtml">branches/safari-601.1.46-branch/LayoutTests/http/tests/contentfiltering/load-substitute-data-from-appcache.html</a></li>
<li><a href="#branchessafari601146branchLayoutTestshttptestscontentfilteringresourcesappcachehtml">branches/safari-601.1.46-branch/LayoutTests/http/tests/contentfiltering/resources/appcache.html</a></li>
<li><a href="#branchessafari601146branchLayoutTestshttptestscontentfilteringresourcesappcachemanifest">branches/safari-601.1.46-branch/LayoutTests/http/tests/contentfiltering/resources/appcache.manifest</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari601146branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (189098 => 189099)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog        2015-08-28 14:24:10 UTC (rev 189098)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog        2015-08-28 16:40:46 UTC (rev 189099)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2015-08-26  Andy Estes  &lt;aestes@apple.com&gt;
+
+        Merge r188988.
+
+    2015-08-26  Andy Estes  &lt;aestes@apple.com&gt;
+
+            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:
+
</ins><span class="cx"> 2015-08-27  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r189024.
</span></span></pre></div>
<a id="branchessafari601146branchLayoutTestshttptestscontentfilteringloadsubstitutedatafromappcacheexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-601.1.46-branch/LayoutTests/http/tests/contentfiltering/load-substitute-data-from-appcache-expected.txt (0 => 189099)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/http/tests/contentfiltering/load-substitute-data-from-appcache-expected.txt                                (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/http/tests/contentfiltering/load-substitute-data-from-appcache-expected.txt        2015-08-28 16:40:46 UTC (rev 189099)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+This is a regression test for webkit.org/b/147651. The test passes if it does not crash.
+
+
</ins></span></pre></div>
<a id="branchessafari601146branchLayoutTestshttptestscontentfilteringloadsubstitutedatafromappcachehtml"></a>
<div class="addfile"><h4>Added: branches/safari-601.1.46-branch/LayoutTests/http/tests/contentfiltering/load-substitute-data-from-appcache.html (0 => 189099)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/http/tests/contentfiltering/load-substitute-data-from-appcache.html                                (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/http/tests/contentfiltering/load-substitute-data-from-appcache.html        2015-08-28 16:40:46 UTC (rev 189099)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;script&gt;
+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(&quot;message&quot;, function() {
+    frames[0].location = &quot;/resources/redirect.php?url=/contentfiltering/resources/appcache.html&quot;;
+});
+&lt;/script&gt;
+&lt;body&gt;
+&lt;p&gt;This is a regression test for &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=147651&quot;&gt;webkit.org/b/147651&lt;/a&gt;. The test passes if it does not crash.&lt;/p&gt;
+&lt;iframe src=&quot;/contentfiltering/resources/appcache.html&quot;&gt;&lt;/iframe&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="branchessafari601146branchLayoutTestshttptestscontentfilteringresourcesappcachehtml"></a>
<div class="addfile"><h4>Added: branches/safari-601.1.46-branch/LayoutTests/http/tests/contentfiltering/resources/appcache.html (0 => 189099)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/http/tests/contentfiltering/resources/appcache.html                                (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/http/tests/contentfiltering/resources/appcache.html        2015-08-28 16:40:46 UTC (rev 189099)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html manifest=&quot;appcache.manifest&quot;&gt;
+&lt;script&gt;
+applicationCache.onnoupdate = function() {
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+applicationCache.oncached = function() {
+    parent.postMessage(&quot;cached&quot;, &quot;*&quot;);
+}
+&lt;/script&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="branchessafari601146branchLayoutTestshttptestscontentfilteringresourcesappcachemanifest"></a>
<div class="addfile"><h4>Added: branches/safari-601.1.46-branch/LayoutTests/http/tests/contentfiltering/resources/appcache.manifest (0 => 189099)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/http/tests/contentfiltering/resources/appcache.manifest                                (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/http/tests/contentfiltering/resources/appcache.manifest        2015-08-28 16:40:46 UTC (rev 189099)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+CACHE MANIFEST
</ins></span></pre></div>
<a id="branchessafari601146branchLayoutTestsplatformmacwk1TestExpectations"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/LayoutTests/platform/mac-wk1/TestExpectations (189098 => 189099)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/platform/mac-wk1/TestExpectations        2015-08-28 14:24:10 UTC (rev 189098)
+++ branches/safari-601.1.46-branch/LayoutTests/platform/mac-wk1/TestExpectations        2015-08-28 16:40:46 UTC (rev 189099)
</span><span class="lines">@@ -124,3 +124,6 @@
</span><span class="cx"> 
</span><span class="cx"> ### END OF (2) Failures without bug reports
</span><span class="cx"> ########################################
</span><ins>+
+# This test is WebKit2-only
+http/tests/contentfiltering/load-substitute-data-from-appcache.html
</ins></span></pre></div>
<a id="branchessafari601146branchToolsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Tools/ChangeLog (189098 => 189099)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Tools/ChangeLog        2015-08-28 14:24:10 UTC (rev 189098)
+++ branches/safari-601.1.46-branch/Tools/ChangeLog        2015-08-28 16:40:46 UTC (rev 189099)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2015-08-26  Andy Estes  &lt;aestes@apple.com&gt;
+
+        Merge r188988.
+
+    2015-08-26  Andy Estes  &lt;aestes@apple.com&gt;
+
+            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):
+
</ins><span class="cx"> 2015-08-26  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r188311.
</span></span></pre></div>
<a id="branchessafari601146branchToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (189098 => 189099)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl        2015-08-28 14:24:10 UTC (rev 189098)
+++ branches/safari-601.1.46-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl        2015-08-28 16:40:46 UTC (rev 189099)
</span><span class="lines">@@ -75,6 +75,7 @@
</span><span class="cx">     void setCacheModel(int model);
</span><span class="cx">     void setAsynchronousSpellCheckingEnabled(boolean value);
</span><span class="cx">     void setPrinting();
</span><ins>+    void setShouldDecideNavigationPolicyAfterDelay(boolean value);
</ins><span class="cx"> 
</span><span class="cx">     // Special DOM functions.
</span><span class="cx">     void clearBackForwardList();
</span></span></pre></div>
<a id="branchessafari601146branchToolsWebKitTestRunnerInjectedBundleInjectedBundlePagecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (189098 => 189099)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp        2015-08-28 14:24:10 UTC (rev 189098)
+++ branches/safari-601.1.46-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp        2015-08-28 16:40:46 UTC (rev 189099)
</span><span class="lines">@@ -1286,6 +1286,9 @@
</span><span class="cx">         injectedBundle.outputText(stringBuilder.toString());
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (injectedBundle.testRunner()-&gt;shouldDecideNavigationPolicyAfterDelay())
+        return WKBundlePagePolicyActionPassThrough;
+
</ins><span class="cx">     if (!injectedBundle.testRunner()-&gt;isPolicyDelegateEnabled())
</span><span class="cx">         return WKBundlePagePolicyActionUse;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari601146branchToolsWebKitTestRunnerInjectedBundleTestRunnercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (189098 => 189099)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp        2015-08-28 14:24:10 UTC (rev 189098)
+++ branches/safari-601.1.46-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp        2015-08-28 16:40:46 UTC (rev 189099)
</span><span class="lines">@@ -851,4 +851,12 @@
</span><span class="cx">     return JSC::setNeverInline(context, theFunction);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TestRunner::setShouldDecideNavigationPolicyAfterDelay(bool value)
+{
+    m_shouldDecideNavigationPolicyAfterDelay = value;
+    WKRetainPtr&lt;WKStringRef&gt; messageName(AdoptWK, WKStringCreateWithUTF8CString(&quot;SetShouldDecideNavigationPolicyAfterDelay&quot;));
+    WKRetainPtr&lt;WKBooleanRef&gt; messageBody(AdoptWK, WKBooleanCreate(value));
+    WKBundlePagePostMessage(InjectedBundle::singleton().page()-&gt;page(), messageName.get(), messageBody.get());
+}
+
</ins><span class="cx"> } // namespace WTR
</span></span></pre></div>
<a id="branchessafari601146branchToolsWebKitTestRunnerInjectedBundleTestRunnerh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (189098 => 189099)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2015-08-28 14:24:10 UTC (rev 189098)
+++ branches/safari-601.1.46-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2015-08-28 16:40:46 UTC (rev 189099)
</span><span class="lines">@@ -281,6 +281,9 @@
</span><span class="cx">     JSValueRef numberOfDFGCompiles(JSValueRef theFunction);
</span><span class="cx">     JSValueRef neverInlineFunction(JSValueRef theFunction);
</span><span class="cx"> 
</span><ins>+    bool shouldDecideNavigationPolicyAfterDelay() const { return m_shouldDecideNavigationPolicyAfterDelay; }
+    void setShouldDecideNavigationPolicyAfterDelay(bool);
+
</ins><span class="cx"> private:
</span><span class="cx">     TestRunner();
</span><span class="cx"> 
</span><span class="lines">@@ -331,6 +334,8 @@
</span><span class="cx">     double m_databaseDefaultQuota;
</span><span class="cx">     double m_databaseMaxQuota;
</span><span class="cx"> 
</span><ins>+    bool m_shouldDecideNavigationPolicyAfterDelay { false };
+
</ins><span class="cx">     bool m_userStyleSheetEnabled;
</span><span class="cx">     WKRetainPtr&lt;WKStringRef&gt; m_userStyleSheetLocation;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari601146branchToolsWebKitTestRunnerTestControllercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Tools/WebKitTestRunner/TestController.cpp (189098 => 189099)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Tools/WebKitTestRunner/TestController.cpp        2015-08-28 14:24:10 UTC (rev 189098)
+++ branches/safari-601.1.46-branch/Tools/WebKitTestRunner/TestController.cpp        2015-08-28 16:40:46 UTC (rev 189099)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx"> #include &lt;ctype.h&gt;
</span><span class="cx"> #include &lt;stdlib.h&gt;
</span><span class="cx"> #include &lt;string&gt;
</span><ins>+#include &lt;wtf/RunLoop.h&gt;
</ins><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="lines">@@ -311,6 +312,8 @@
</span><span class="cx"> 
</span><span class="cx"> void TestController::initialize(int argc, const char* argv[])
</span><span class="cx"> {
</span><ins>+    RunLoop::initializeMainRunLoop();
+
</ins><span class="cx">     platformInitialize();
</span><span class="cx"> 
</span><span class="cx">     Options options;
</span><span class="lines">@@ -717,6 +720,8 @@
</span><span class="cx">     // Reset main page back to about:blank
</span><span class="cx">     m_doneResetting = false;
</span><span class="cx"> 
</span><ins>+    m_shouldDecideNavigationPolicyAfterDelay = false;
+
</ins><span class="cx">     WKPageLoadURL(m_mainWebView-&gt;page(), blankURL());
</span><span class="cx">     runUntil(m_doneResetting, shortTimeout);
</span><span class="cx">     return m_doneResetting;
</span><span class="lines">@@ -1548,12 +1553,19 @@
</span><span class="cx"> 
</span><span class="cx"> void TestController::decidePolicyForNavigationAction(WKFramePolicyListenerRef listener)
</span><span class="cx"> {
</span><del>-    if (m_policyDelegateEnabled &amp;&amp; !m_policyDelegatePermissive) {
-        WKFramePolicyListenerIgnore(listener);
-        return;
-    }
</del><ins>+    WKRetainPtr&lt;WKFramePolicyListenerRef&gt; retainedListener { listener };
+    const bool shouldIgnore { m_policyDelegateEnabled &amp;&amp; !m_policyDelegatePermissive };
+    std::function&lt;void()&gt; decisionFunction = [shouldIgnore, retainedListener]() {
+        if (shouldIgnore)
+            WKFramePolicyListenerIgnore(retainedListener.get());
+        else
+            WKFramePolicyListenerUse(retainedListener.get());
+    };
</ins><span class="cx"> 
</span><del>-    WKFramePolicyListenerUse(listener);
</del><ins>+    if (m_shouldDecideNavigationPolicyAfterDelay)
+        RunLoop::main().dispatch(decisionFunction);
+    else
+        decisionFunction();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TestController::decidePolicyForNavigationResponse(WKPageRef, WKNavigationResponseRef navigationResponse, WKFramePolicyListenerRef listener, WKTypeRef, const void* clientInfo)
</span></span></pre></div>
<a id="branchessafari601146branchToolsWebKitTestRunnerTestControllerh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Tools/WebKitTestRunner/TestController.h (189098 => 189099)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Tools/WebKitTestRunner/TestController.h        2015-08-28 14:24:10 UTC (rev 189098)
+++ branches/safari-601.1.46-branch/Tools/WebKitTestRunner/TestController.h        2015-08-28 16:40:46 UTC (rev 189099)
</span><span class="lines">@@ -121,6 +121,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool isCurrentInvocation(TestInvocation* invocation) const { return invocation == m_currentInvocation.get(); }
</span><span class="cx"> 
</span><ins>+    void setShouldDecideNavigationPolicyAfterDelay(bool value) { m_shouldDecideNavigationPolicyAfterDelay = value; }
+
</ins><span class="cx"> private:
</span><span class="cx">     void initialize(int argc, const char* argv[]);
</span><span class="cx">     void createWebViewWithOptions(WKDictionaryRef);
</span><span class="lines">@@ -273,6 +275,8 @@
</span><span class="cx">     bool m_shouldLogHistoryClientCallbacks;
</span><span class="cx">     bool m_shouldShowWebView;
</span><span class="cx"> 
</span><ins>+    bool m_shouldDecideNavigationPolicyAfterDelay { false };
+
</ins><span class="cx">     std::unique_ptr&lt;EventSenderProxy&gt; m_eventSenderProxy;
</span><span class="cx"> 
</span><span class="cx">     WorkQueueManager m_workQueueManager;
</span></span></pre></div>
<a id="branchessafari601146branchToolsWebKitTestRunnerTestInvocationcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Tools/WebKitTestRunner/TestInvocation.cpp (189098 => 189099)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Tools/WebKitTestRunner/TestInvocation.cpp        2015-08-28 14:24:10 UTC (rev 189098)
+++ branches/safari-601.1.46-branch/Tools/WebKitTestRunner/TestInvocation.cpp        2015-08-28 16:40:46 UTC (rev 189099)
</span><span class="lines">@@ -630,6 +630,13 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (WKStringIsEqualToUTF8CString(messageName, &quot;SetShouldDecideNavigationPolicyAfterDelay&quot;)) {
+        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
+        WKBooleanRef value = static_cast&lt;WKBooleanRef&gt;(messageBody);
+        TestController::singleton().setShouldDecideNavigationPolicyAfterDelay(WKBooleanGetValue(value));
+        return;
+    }
+
</ins><span class="cx">     ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>