<!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>[182637] trunk</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/182637">182637</a></dd>
<dt>Author</dt> <dd>aestes@apple.com</dd>
<dt>Date</dt> <dd>2015-04-10 12:00:31 -0700 (Fri, 10 Apr 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Content Filtering] Support modifying request URLs
https://bugs.webkit.org/show_bug.cgi?id=143599
rdar://problem/20442560
Reviewed by Darin Adler.
Source/WebCore:
Tests: contentfiltering/modify-request-url.html
http/tests/contentfiltering/modify-redirect-request-url.html
Allow NEFilterSource to modifiy request URLs. Also teach MockContentFilter to do the same for testing.
* platform/cocoa/NetworkExtensionContentFilter.mm:
(WebCore::NetworkExtensionContentFilter::willSendRequest): If NEFilterSource provided a string representing a
valid URL in decisionInfo[NEFilterSourceOptionsRedirectURL], then used that as the request URL.
* platform/spi/cocoa/NEFilterSourceSPI.h: Temporarily defined NEFilterSourceOptionsRedirectURL.
* testing/MockContentFilter.cpp:
(WebCore::MockContentFilter::willSendRequest): If settings() has a valid modifiedRequestURL, use it as the
request URL. Only do so once MockContentFilter has reached its decision point so that both initial requests and
redirect requests can be tested.
* testing/MockContentFilterSettings.h: Added modifiedRequestURL.
(WebCore::MockContentFilterSettings::modifiedRequestURL): Ditto.
(WebCore::MockContentFilterSettings::setModifiedRequestURL): Ditto.
* testing/MockContentFilterSettings.idl: Ditto.
LayoutTests:
* contentfiltering/allow-after-add-data-expected.html: Changed to use pass.html.
* contentfiltering/allow-after-finished-adding-data-expected.html: Ditto.
* contentfiltering/allow-after-response-expected.html: Ditto.
* contentfiltering/allow-after-will-send-request-expected.html: Ditto.
* contentfiltering/block-after-add-data-expected.html: Ditto.
* contentfiltering/block-after-add-data-then-allow-unblock-expected.html: Ditto.
* contentfiltering/block-after-add-data-then-deny-unblock-expected.html: Ditto.
* contentfiltering/block-after-finished-adding-data-expected.html: Ditto.
* contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.html: Ditto.
* contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.html: Ditto.
* contentfiltering/block-after-response-expected.html: Ditto.
* contentfiltering/block-after-response-then-allow-unblock-expected.html: Ditto.
* contentfiltering/block-after-response-then-deny-unblock-expected.html: Ditto.
* contentfiltering/block-after-will-send-request-expected.html: Ditto.
* contentfiltering/block-after-will-send-request-then-allow-unblock-expected.html: Ditto.
* contentfiltering/block-after-will-send-request-then-deny-unblock-expected.html: Ditto.
* contentfiltering/modify-request-url-expected.html: Added.
* contentfiltering/modify-request-url.html: Added.
* contentfiltering/resources/fail.html: Added.
* contentfiltering/resources/pass.html: Added.
* http/tests/contentfiltering/allow-after-redirect-expected.html: Removed the body tag.
* http/tests/contentfiltering/block-after-redirect-expected.html: Ditto.
* http/tests/contentfiltering/modify-redirect-request-url-expected.html: Added.
* http/tests/contentfiltering/modify-redirect-request-url.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestscontentfilteringallowafteradddataexpectedhtml">trunk/LayoutTests/contentfiltering/allow-after-add-data-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringallowafterfinishedaddingdataexpectedhtml">trunk/LayoutTests/contentfiltering/allow-after-finished-adding-data-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringallowafterresponseexpectedhtml">trunk/LayoutTests/contentfiltering/allow-after-response-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringallowafterwillsendrequestexpectedhtml">trunk/LayoutTests/contentfiltering/allow-after-will-send-request-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafteradddataexpectedhtml">trunk/LayoutTests/contentfiltering/block-after-add-data-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafteradddatathenallowunblockexpectedhtml">trunk/LayoutTests/contentfiltering/block-after-add-data-then-allow-unblock-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafteradddatathendenyunblockexpectedhtml">trunk/LayoutTests/contentfiltering/block-after-add-data-then-deny-unblock-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafterfinishedaddingdataexpectedhtml">trunk/LayoutTests/contentfiltering/block-after-finished-adding-data-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafterfinishedaddingdatathenallowunblockexpectedhtml">trunk/LayoutTests/contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafterfinishedaddingdatathendenyunblockexpectedhtml">trunk/LayoutTests/contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafterresponseexpectedhtml">trunk/LayoutTests/contentfiltering/block-after-response-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafterresponsethenallowunblockexpectedhtml">trunk/LayoutTests/contentfiltering/block-after-response-then-allow-unblock-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafterresponsethendenyunblockexpectedhtml">trunk/LayoutTests/contentfiltering/block-after-response-then-deny-unblock-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafterwillsendrequestexpectedhtml">trunk/LayoutTests/contentfiltering/block-after-will-send-request-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafterwillsendrequestthenallowunblockexpectedhtml">trunk/LayoutTests/contentfiltering/block-after-will-send-request-then-allow-unblock-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafterwillsendrequestthendenyunblockexpectedhtml">trunk/LayoutTests/contentfiltering/block-after-will-send-request-then-deny-unblock-expected.html</a></li>
<li><a href="#trunkLayoutTestshttptestscontentfilteringallowafterredirectexpectedhtml">trunk/LayoutTests/http/tests/contentfiltering/allow-after-redirect-expected.html</a></li>
<li><a href="#trunkLayoutTestshttptestscontentfilteringblockafterredirectexpectedhtml">trunk/LayoutTests/http/tests/contentfiltering/block-after-redirect-expected.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformcocoaNetworkExtensionContentFiltermm">trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformspicocoaNEFilterSourceSPIh">trunk/Source/WebCore/platform/spi/cocoa/NEFilterSourceSPI.h</a></li>
<li><a href="#trunkSourceWebCoretestingMockContentFiltercpp">trunk/Source/WebCore/testing/MockContentFilter.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingMockContentFilterSettingsh">trunk/Source/WebCore/testing/MockContentFilterSettings.h</a></li>
<li><a href="#trunkSourceWebCoretestingMockContentFilterSettingsidl">trunk/Source/WebCore/testing/MockContentFilterSettings.idl</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscontentfilteringmodifyrequesturlexpectedhtml">trunk/LayoutTests/contentfiltering/modify-request-url-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringmodifyrequesturlhtml">trunk/LayoutTests/contentfiltering/modify-request-url.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringresourcesfailhtml">trunk/LayoutTests/contentfiltering/resources/fail.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringresourcespasshtml">trunk/LayoutTests/contentfiltering/resources/pass.html</a></li>
<li><a href="#trunkLayoutTestshttptestscontentfilteringmodifyredirectrequesturlexpectedhtml">trunk/LayoutTests/http/tests/contentfiltering/modify-redirect-request-url-expected.html</a></li>
<li><a href="#trunkLayoutTestshttptestscontentfilteringmodifyredirectrequesturlhtml">trunk/LayoutTests/http/tests/contentfiltering/modify-redirect-request-url.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/ChangeLog        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2015-04-10 Andy Estes <aestes@apple.com>
+
+ [Content Filtering] Support modifying request URLs
+ https://bugs.webkit.org/show_bug.cgi?id=143599
+ rdar://problem/20442560
+
+ Reviewed by Darin Adler.
+
+ * contentfiltering/allow-after-add-data-expected.html: Changed to use pass.html.
+ * contentfiltering/allow-after-finished-adding-data-expected.html: Ditto.
+ * contentfiltering/allow-after-response-expected.html: Ditto.
+ * contentfiltering/allow-after-will-send-request-expected.html: Ditto.
+ * contentfiltering/block-after-add-data-expected.html: Ditto.
+ * contentfiltering/block-after-add-data-then-allow-unblock-expected.html: Ditto.
+ * contentfiltering/block-after-add-data-then-deny-unblock-expected.html: Ditto.
+ * contentfiltering/block-after-finished-adding-data-expected.html: Ditto.
+ * contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.html: Ditto.
+ * contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.html: Ditto.
+ * contentfiltering/block-after-response-expected.html: Ditto.
+ * contentfiltering/block-after-response-then-allow-unblock-expected.html: Ditto.
+ * contentfiltering/block-after-response-then-deny-unblock-expected.html: Ditto.
+ * contentfiltering/block-after-will-send-request-expected.html: Ditto.
+ * contentfiltering/block-after-will-send-request-then-allow-unblock-expected.html: Ditto.
+ * contentfiltering/block-after-will-send-request-then-deny-unblock-expected.html: Ditto.
+ * contentfiltering/modify-request-url-expected.html: Added.
+ * contentfiltering/modify-request-url.html: Added.
+ * contentfiltering/resources/fail.html: Added.
+ * contentfiltering/resources/pass.html: Added.
+ * http/tests/contentfiltering/allow-after-redirect-expected.html: Removed the body tag.
+ * http/tests/contentfiltering/block-after-redirect-expected.html: Ditto.
+ * http/tests/contentfiltering/modify-redirect-request-url-expected.html: Added.
+ * http/tests/contentfiltering/modify-redirect-request-url.html: Added.
+
</ins><span class="cx"> 2015-04-10 ChangSeok Oh <changseok.oh@collabora.com>
</span><span class="cx">
</span><span class="cx"> [Win] Layout Test fast/backgrounds/selection-background-color-of-list-style.html is failing
</span></span></pre></div>
<a id="trunkLayoutTestscontentfilteringallowafteradddataexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/contentfiltering/allow-after-add-data-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/allow-after-add-data-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/contentfiltering/allow-after-add-data-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<iframe src="data:text/html,<!DOCTYPE html><body>PASS"></iframe>
</del><ins>+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringallowafterfinishedaddingdataexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/contentfiltering/allow-after-finished-adding-data-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/allow-after-finished-adding-data-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/contentfiltering/allow-after-finished-adding-data-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<iframe src="data:text/html,<!DOCTYPE html><body>PASS"></iframe>
</del><ins>+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringallowafterresponseexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/contentfiltering/allow-after-response-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/allow-after-response-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/contentfiltering/allow-after-response-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<iframe src="data:text/html,<!DOCTYPE html><body>PASS"></iframe>
</del><ins>+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringallowafterwillsendrequestexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/contentfiltering/allow-after-will-send-request-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/allow-after-will-send-request-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/contentfiltering/allow-after-will-send-request-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<iframe src="data:text/html,<!DOCTYPE html><body>PASS"></iframe>
</del><ins>+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafteradddataexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/contentfiltering/block-after-add-data-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-add-data-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/contentfiltering/block-after-add-data-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<iframe src="data:text/html,<!DOCTYPE html><body>PASS"></iframe>
</del><ins>+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafteradddatathenallowunblockexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/contentfiltering/block-after-add-data-then-allow-unblock-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-add-data-then-allow-unblock-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/contentfiltering/block-after-add-data-then-allow-unblock-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<iframe src="data:text/html,<!DOCTYPE html><body>PASS"></iframe>
</del><ins>+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafteradddatathendenyunblockexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/contentfiltering/block-after-add-data-then-deny-unblock-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-add-data-then-deny-unblock-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/contentfiltering/block-after-add-data-then-deny-unblock-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<iframe src="data:text/html,<!DOCTYPE html><body>PASS"></iframe>
</del><ins>+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafterfinishedaddingdataexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/contentfiltering/block-after-finished-adding-data-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-finished-adding-data-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/contentfiltering/block-after-finished-adding-data-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<iframe src="data:text/html,<!DOCTYPE html><body>PASS"></iframe>
</del><ins>+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafterfinishedaddingdatathenallowunblockexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/contentfiltering/block-after-finished-adding-data-then-allow-unblock-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<iframe src="data:text/html,<!DOCTYPE html><body>PASS"></iframe>
</del><ins>+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafterfinishedaddingdatathendenyunblockexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/contentfiltering/block-after-finished-adding-data-then-deny-unblock-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<iframe src="data:text/html,<!DOCTYPE html><body>PASS"></iframe>
</del><ins>+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafterresponseexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/contentfiltering/block-after-response-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-response-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/contentfiltering/block-after-response-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<iframe src="data:text/html,<!DOCTYPE html><body>PASS"></iframe>
</del><ins>+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafterresponsethenallowunblockexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/contentfiltering/block-after-response-then-allow-unblock-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-response-then-allow-unblock-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/contentfiltering/block-after-response-then-allow-unblock-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<iframe src="data:text/html,<!DOCTYPE html><body>PASS"></iframe>
</del><ins>+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafterresponsethendenyunblockexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/contentfiltering/block-after-response-then-deny-unblock-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-response-then-deny-unblock-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/contentfiltering/block-after-response-then-deny-unblock-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<iframe src="data:text/html,<!DOCTYPE html><body>PASS"></iframe>
</del><ins>+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafterwillsendrequestexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/contentfiltering/block-after-will-send-request-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-will-send-request-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/contentfiltering/block-after-will-send-request-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<iframe src="data:text/html,<!DOCTYPE html><body>PASS"></iframe>
</del><ins>+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafterwillsendrequestthenallowunblockexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/contentfiltering/block-after-will-send-request-then-allow-unblock-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-will-send-request-then-allow-unblock-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/contentfiltering/block-after-will-send-request-then-allow-unblock-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<iframe src="data:text/html,<!DOCTYPE html><body>PASS"></iframe>
</del><ins>+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafterwillsendrequestthendenyunblockexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/contentfiltering/block-after-will-send-request-then-deny-unblock-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-will-send-request-then-deny-unblock-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/contentfiltering/block-after-will-send-request-then-deny-unblock-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<iframe src="data:text/html,<!DOCTYPE html><body>PASS"></iframe>
</del><ins>+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringmodifyrequesturlexpectedhtmlfromrev182635trunkLayoutTestshttptestscontentfilteringallowafterredirectexpectedhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/contentfiltering/modify-request-url-expected.html (from rev 182635, trunk/LayoutTests/http/tests/contentfiltering/allow-after-redirect-expected.html) (0 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/modify-request-url-expected.html         (rev 0)
+++ trunk/LayoutTests/contentfiltering/modify-request-url-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+<!DOCTYPE html>
+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringmodifyrequesturlhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/contentfiltering/modify-request-url.html (0 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/modify-request-url.html         (rev 0)
+++ trunk/LayoutTests/contentfiltering/modify-request-url.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<!DOCTYPE html>
+<script>
+if (window.internals) {
+ var settings = window.internals.mockContentFilterSettings;
+ settings.enabled = true;
+ settings.decisionPoint = settings.DECISION_POINT_AFTER_WILL_SEND_REQUEST;
+ settings.decision = settings.DECISION_ALLOW;
+ settings.modifiedRequestURL = "pass.html";
+}
+</script>
+<iframe src="resources/fail.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringresourcesfailhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/contentfiltering/resources/fail.html (0 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/resources/fail.html         (rev 0)
+++ trunk/LayoutTests/contentfiltering/resources/fail.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!DOCTYPE html><body>FAIL
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringresourcespasshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/contentfiltering/resources/pass.html (0 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/resources/pass.html         (rev 0)
+++ trunk/LayoutTests/contentfiltering/resources/pass.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+<!DOCTYPE html><body>PASS
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestscontentfilteringallowafterredirectexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/contentfiltering/allow-after-redirect-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/contentfiltering/allow-after-redirect-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/http/tests/contentfiltering/allow-after-redirect-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,3 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<body>
</del><span class="cx"> <iframe src="resources/pass.html"></iframe>
</span></span></pre></div>
<a id="trunkLayoutTestshttptestscontentfilteringblockafterredirectexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/contentfiltering/block-after-redirect-expected.html (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/contentfiltering/block-after-redirect-expected.html        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/LayoutTests/http/tests/contentfiltering/block-after-redirect-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,3 +1,2 @@
</span><span class="cx"> <!DOCTYPE html>
</span><del>-<body>
</del><span class="cx"> <iframe src="resources/pass.html"></iframe>
</span></span></pre></div>
<a id="trunkLayoutTestshttptestscontentfilteringmodifyredirectrequesturlexpectedhtmlfromrev182635trunkLayoutTestshttptestscontentfilteringblockafterredirectexpectedhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/http/tests/contentfiltering/modify-redirect-request-url-expected.html (from rev 182635, trunk/LayoutTests/http/tests/contentfiltering/block-after-redirect-expected.html) (0 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/contentfiltering/modify-redirect-request-url-expected.html         (rev 0)
+++ trunk/LayoutTests/http/tests/contentfiltering/modify-redirect-request-url-expected.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+<!DOCTYPE html>
+<iframe src="resources/pass.html"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestscontentfilteringmodifyredirectrequesturlhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/contentfiltering/modify-redirect-request-url.html (0 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/contentfiltering/modify-redirect-request-url.html         (rev 0)
+++ trunk/LayoutTests/http/tests/contentfiltering/modify-redirect-request-url.html        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<!DOCTYPE html>
+<script>
+if (window.internals) {
+ var settings = window.internals.mockContentFilterSettings;
+ settings.enabled = true;
+ settings.decisionPoint = settings.DECISION_POINT_AFTER_REDIRECT;
+ settings.decision = settings.DECISION_ALLOW;
+ settings.modifiedRequestURL = "pass.html";
+}
+</script>
+<iframe src="/resources/redirect.php?url=/contentfiltering/resources/fail.html"></iframe>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/Source/WebCore/ChangeLog        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2015-04-10 Andy Estes <aestes@apple.com>
+
+ [Content Filtering] Support modifying request URLs
+ https://bugs.webkit.org/show_bug.cgi?id=143599
+ rdar://problem/20442560
+
+ Reviewed by Darin Adler.
+
+ Tests: contentfiltering/modify-request-url.html
+ http/tests/contentfiltering/modify-redirect-request-url.html
+
+ Allow NEFilterSource to modifiy request URLs. Also teach MockContentFilter to do the same for testing.
+
+ * platform/cocoa/NetworkExtensionContentFilter.mm:
+ (WebCore::NetworkExtensionContentFilter::willSendRequest): If NEFilterSource provided a string representing a
+ valid URL in decisionInfo[NEFilterSourceOptionsRedirectURL], then used that as the request URL.
+ * platform/spi/cocoa/NEFilterSourceSPI.h: Temporarily defined NEFilterSourceOptionsRedirectURL.
+ * testing/MockContentFilter.cpp:
+ (WebCore::MockContentFilter::willSendRequest): If settings() has a valid modifiedRequestURL, use it as the
+ request URL. Only do so once MockContentFilter has reached its decision point so that both initial requests and
+ redirect requests can be tested.
+ * testing/MockContentFilterSettings.h: Added modifiedRequestURL.
+ (WebCore::MockContentFilterSettings::modifiedRequestURL): Ditto.
+ (WebCore::MockContentFilterSettings::setModifiedRequestURL): Ditto.
+ * testing/MockContentFilterSettings.idl: Ditto.
+
</ins><span class="cx"> 2015-04-10 Zalan Bujtas <zalan@apple.com>
</span><span class="cx">
</span><span class="cx"> showRenderTree: Include the render object to the inlinebox output.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaNetworkExtensionContentFiltermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -90,7 +90,10 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- [m_neFilterSource willSendRequest:request.nsURLRequest(DoNotUpdateHTTPBody) decisionHandler:[this](NEFilterSourceStatus status, NSDictionary *decisionInfo) {
</del><ins>+ RetainPtr<NSString> modifiedRequestURLString;
+ [m_neFilterSource willSendRequest:request.nsURLRequest(DoNotUpdateHTTPBody) decisionHandler:[this, &modifiedRequestURLString](NEFilterSourceStatus status, NSDictionary *decisionInfo) {
+ modifiedRequestURLString = decisionInfo[NEFilterSourceOptionsRedirectURL];
+ ASSERT(!modifiedRequestURLString || [modifiedRequestURLString isKindOfClass:[NSString class]]);
</ins><span class="cx"> handleDecision(status, replacementDataFromDecisionInfo(decisionInfo));
</span><span class="cx"> }];
</span><span class="cx">
</span><span class="lines">@@ -98,6 +101,17 @@
</span><span class="cx"> // blocked/not blocked answer from the filter immediately after calling
</span><span class="cx"> // addData(). We should find a way to make this asynchronous.
</span><span class="cx"> dispatch_semaphore_wait(m_semaphore.get(), DISPATCH_TIME_FOREVER);
</span><ins>+
+ if (!modifiedRequestURLString)
+ return;
+
+ URL modifiedRequestURL { URL(), modifiedRequestURLString.get() };
+ if (!modifiedRequestURL.isValid()) {
+ LOG(ContentFiltering, "NetworkExtensionContentFilter failed to convert modified URL string %@ to a WebCore::URL.\n", modifiedRequestURLString.get());
+ return;
+ }
+
+ request.setURL(modifiedRequestURL);
</ins><span class="cx"> #else
</span><span class="cx"> UNUSED_PARAM(request);
</span><span class="cx"> UNUSED_PARAM(redirectResponse);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformspicocoaNEFilterSourceSPIh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/spi/cocoa/NEFilterSourceSPI.h (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/spi/cocoa/NEFilterSourceSPI.h        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/Source/WebCore/platform/spi/cocoa/NEFilterSourceSPI.h        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -74,4 +74,9 @@
</span><span class="cx">
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#endif // !USE(APPLE_INTERNAL_SDK)
+
+// FIXME: Remove once NEFilterSourceOptionsRedirectURL is defined in the SDK.
+#ifndef NEFilterSourceOptionsRedirectURL
+#define NEFilterSourceOptionsRedirectURL @"RedirectURL"
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoretestingMockContentFiltercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/MockContentFilter.cpp (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockContentFilter.cpp        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/Source/WebCore/testing/MockContentFilter.cpp        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -68,12 +68,27 @@
</span><span class="cx"> return std::make_unique<MockContentFilter>();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void MockContentFilter::willSendRequest(ResourceRequest&, const ResourceResponse& redirectResponse)
</del><ins>+void MockContentFilter::willSendRequest(ResourceRequest& request, const ResourceResponse& redirectResponse)
</ins><span class="cx"> {
</span><span class="cx"> if (redirectResponse.isNull())
</span><span class="cx"> maybeDetermineStatus(DecisionPoint::AfterWillSendRequest);
</span><span class="cx"> else
</span><span class="cx"> maybeDetermineStatus(DecisionPoint::AfterRedirect);
</span><ins>+
+ if (m_status == Status::NeedsMoreData)
+ return;
+
+ String modifiedRequestURLString { settings().modifiedRequestURL() };
+ if (modifiedRequestURLString.isEmpty())
+ return;
+
+ URL modifiedRequestURL { request.url(), modifiedRequestURLString };
+ if (!modifiedRequestURL.isValid()) {
+ LOG(ContentFiltering, "MockContentFilter failed to convert %s to a WebCore::URL.\n", modifiedRequestURL.string().ascii().data());
+ return;
+ }
+
+ request.setURL(modifiedRequestURL);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MockContentFilter::responseReceived(const ResourceResponse&)
</span></span></pre></div>
<a id="trunkSourceWebCoretestingMockContentFilterSettingsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/MockContentFilterSettings.h (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockContentFilterSettings.h        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/Source/WebCore/testing/MockContentFilterSettings.h        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -73,6 +73,9 @@
</span><span class="cx">
</span><span class="cx"> const String& unblockRequestURL() const;
</span><span class="cx">
</span><ins>+ const String& modifiedRequestURL() const { return m_modifiedRequestURL; }
+ void setModifiedRequestURL(const String& modifiedRequestURL) { m_modifiedRequestURL = modifiedRequestURL; }
+
</ins><span class="cx"> private:
</span><span class="cx"> MockContentFilterSettings() = default;
</span><span class="cx"> MockContentFilterSettings(const MockContentFilterSettings&) = delete;
</span><span class="lines">@@ -83,6 +86,7 @@
</span><span class="cx"> Decision m_decision { Decision::Allow };
</span><span class="cx"> Decision m_unblockRequestDecision { Decision::Block };
</span><span class="cx"> String m_blockedString;
</span><ins>+ String m_modifiedRequestURL;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoretestingMockContentFilterSettingsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/MockContentFilterSettings.idl (182636 => 182637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockContentFilterSettings.idl        2015-04-10 18:55:54 UTC (rev 182636)
+++ trunk/Source/WebCore/testing/MockContentFilterSettings.idl        2015-04-10 19:00:31 UTC (rev 182637)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> ] interface MockContentFilterSettings {
</span><span class="cx"> attribute boolean enabled;
</span><span class="cx"> attribute DOMString blockedString;
</span><ins>+ attribute DOMString modifiedRequestURL;
</ins><span class="cx">
</span><span class="cx"> const octet DECISION_POINT_AFTER_WILL_SEND_REQUEST = 0;
</span><span class="cx"> const octet DECISION_POINT_AFTER_REDIRECT = 1;
</span></span></pre>
</div>
</div>
</body>
</html>