<!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>[181291] 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/181291">181291</a></dd>
<dt>Author</dt> <dd>aestes@apple.com</dd>
<dt>Date</dt> <dd>2015-03-09 16:39:05 -0700 (Mon, 09 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Content Filtering] Add tests
https://bugs.webkit.org/show_bug.cgi?id=142475

Reviewed by Andreas Kling.

Source/WebCore:

Added a mock content filter that can be configured by window.internals. A test can control whether the filter
is enabled, what to display when a page is blocked, at what point the allow/block decision is made, and what
decision to make.

Added tests to cover allowing and blocking content at each decision point.

Tests: contentfiltering/allow-after-add-data.html
       contentfiltering/allow-after-finished-adding-data.html
       contentfiltering/allow-after-response.html
       contentfiltering/block-after-add-data.html
       contentfiltering/block-after-finished-adding-data.html
       contentfiltering/block-after-response.html

* DerivedSources.make: Added MockContentFilterSettings.idl.
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSMockContentFilterSettingsCustom.cpp: Added.
(WebCore::JSMockContentFilterSettings::decisionPoint): Returned the decision point's JSValue.
(WebCore::JSMockContentFilterSettings::setDecisionPoint): Set the decision point; threw an exception for invalid values.
(WebCore::JSMockContentFilterSettings::decision): Returned the decision's JSValue.
(WebCore::JSMockContentFilterSettings::setDecision): Set the decision; threw an exception for invalid values.
* platform/ContentFilter.cpp:
(WebCore::ContentFilter::types): Renamed from contentFilterTypes.
(WebCore::ContentFilter::createIfNeeded):
(WebCore::contentFilterType): Deleted.
(WebCore::contentFilterTypes): Deleted.
* platform/ContentFilter.h:
(WebCore::ContentFilter::addType): Used to register a new content filter type.
(WebCore::ContentFilter::type): Renamed from contentFilterType.
* platform/cocoa/NetworkExtensionContentFilter.h: Moved definition of HAVE_NE_FILTER_SOURCE to here.
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState): Called MockContentFilterSettings::reset().
(WebCore::Internals::Internals): Called MockContentFilter::ensureInstalled().
(WebCore::Internals::mockContentFilterSettings): Returned a reference to MockContentFilterSettings::singleton().
* testing/Internals.h:
* testing/Internals.idl: Added attribute mockContentFilterSettings.
* testing/MockContentFilter.cpp: Added.
(WebCore::MockContentFilter::ensureInstalled): Called MockContentFilter::addType().
(WebCore::MockContentFilter::canHandleResponse): Returned whether MockContentFilterSettings is enabled.
(WebCore::MockContentFilter::create): Returned a new MockContentFilter.
(WebCore::MockContentFilter::MockContentFilter): Called maybeDetermineStatus().
(WebCore::MockContentFilter::addData): Copied data into m_replacementData and called maybeDetermineStatus().
(WebCore::MockContentFilter::finishedAddingData): Called maybeDetermineStatus().
(WebCore::MockContentFilter::needsMoreData): Returned whether m_status equals NeedsMoreData.
(WebCore::MockContentFilter::didBlockData): Returned whether m_status equals Blocked.
(WebCore::MockContentFilter::getReplacementData): Returned a pointer to the start of m_replacementData.
(WebCore::MockContentFilter::unblockHandler): Returned an empty ContentFilterUnblockHandler.
(WebCore::MockContentFilter::maybeDetermineStatus): If m_status is NeedsMoreData and the current decision point
equals MockContentFilterSettings's decision point, set m_status according to MockContentFilterSettings's
decision. If m_status becomes Blocked, clear the original page data from m_replacementData and copy
MockContentFilterSettings's blocked string instead.
* testing/MockContentFilter.h: Copied from Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.h.
* testing/MockContentFilterSettings.cpp: Copied from Source/WebCore/platform/ContentFilter.h.
(WebCore::MockContentFilterSettings::singleton):
(WebCore::MockContentFilterSettings::reset): Reset settings to their initial values.
(WebCore::MockContentFilterSettings::MockContentFilterSettings):
* testing/MockContentFilterSettings.h: Copied from Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.h.
(WebCore::MockContentFilterSettings::ref): Added an empty implementation to make the bindings think this is RefCounted.
(WebCore::MockContentFilterSettings::deref): Ditto.
(WebCore::MockContentFilterSettings::enabled):
(WebCore::MockContentFilterSettings::setEnabled):
(WebCore::MockContentFilterSettings::blockedString):
(WebCore::MockContentFilterSettings::setBlockedString):
(WebCore::MockContentFilterSettings::decisionPoint):
(WebCore::MockContentFilterSettings::setDecisionPoint):
(WebCore::MockContentFilterSettings::decision):
(WebCore::MockContentFilterSettings::setDecision):
* testing/MockContentFilterSettings.idl: Copied from Source/WebCore/platform/ContentFilter.h.

LayoutTests:

* contentfiltering/allow-after-add-data-expected.html: Added.
* contentfiltering/allow-after-add-data.html: Added.
* contentfiltering/allow-after-finished-adding-data-expected.html: Added.
* contentfiltering/allow-after-finished-adding-data.html: Added.
* contentfiltering/allow-after-response-expected.html: Added.
* contentfiltering/allow-after-response.html: Added.
* contentfiltering/block-after-add-data-expected.html: Added.
* contentfiltering/block-after-add-data.html: Added.
* contentfiltering/block-after-finished-adding-data-expected.html: Added.
* contentfiltering/block-after-finished-adding-data.html: Added.
* contentfiltering/block-after-response-expected.html: Added.
* contentfiltering/block-after-response.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformeflTestExpectations">trunk/LayoutTests/platform/efl/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformgtkTestExpectations">trunk/LayoutTests/platform/gtk/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformwinTestExpectations">trunk/LayoutTests/platform/win/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreDerivedSourcesmake">trunk/Source/WebCore/DerivedSources.make</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreplatformContentFiltercpp">trunk/Source/WebCore/platform/ContentFilter.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformContentFilterh">trunk/Source/WebCore/platform/ContentFilter.h</a></li>
<li><a href="#trunkSourceWebCoreplatformcocoaNetworkExtensionContentFilterh">trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsh">trunk/Source/WebCore/testing/Internals.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsidl">trunk/Source/WebCore/testing/Internals.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/contentfiltering/</li>
<li><a href="#trunkLayoutTestscontentfilteringallowafteradddataexpectedhtml">trunk/LayoutTests/contentfiltering/allow-after-add-data-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringallowafteradddatahtml">trunk/LayoutTests/contentfiltering/allow-after-add-data.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringallowafterfinishedaddingdataexpectedhtml">trunk/LayoutTests/contentfiltering/allow-after-finished-adding-data-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringallowafterfinishedaddingdatahtml">trunk/LayoutTests/contentfiltering/allow-after-finished-adding-data.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringallowafterresponseexpectedhtml">trunk/LayoutTests/contentfiltering/allow-after-response-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringallowafterresponsehtml">trunk/LayoutTests/contentfiltering/allow-after-response.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafteradddataexpectedhtml">trunk/LayoutTests/contentfiltering/block-after-add-data-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafteradddatahtml">trunk/LayoutTests/contentfiltering/block-after-add-data.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafterfinishedaddingdataexpectedhtml">trunk/LayoutTests/contentfiltering/block-after-finished-adding-data-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafterfinishedaddingdatahtml">trunk/LayoutTests/contentfiltering/block-after-finished-adding-data.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafterresponseexpectedhtml">trunk/LayoutTests/contentfiltering/block-after-response-expected.html</a></li>
<li><a href="#trunkLayoutTestscontentfilteringblockafterresponsehtml">trunk/LayoutTests/contentfiltering/block-after-response.html</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSMockContentFilterSettingsCustomcpp">trunk/Source/WebCore/bindings/js/JSMockContentFilterSettingsCustom.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingMockContentFiltercpp">trunk/Source/WebCore/testing/MockContentFilter.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingMockContentFilterh">trunk/Source/WebCore/testing/MockContentFilter.h</a></li>
<li><a href="#trunkSourceWebCoretestingMockContentFilterSettingscpp">trunk/Source/WebCore/testing/MockContentFilterSettings.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>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (181290 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-03-09 23:30:35 UTC (rev 181290)
+++ trunk/LayoutTests/ChangeLog        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2015-03-09  Andy Estes  &lt;aestes@apple.com&gt;
+
+        [Content Filtering] Add tests
+        https://bugs.webkit.org/show_bug.cgi?id=142475
+
+        Reviewed by Andreas Kling.
+
+        * contentfiltering/allow-after-add-data-expected.html: Added.
+        * contentfiltering/allow-after-add-data.html: Added.
+        * contentfiltering/allow-after-finished-adding-data-expected.html: Added.
+        * contentfiltering/allow-after-finished-adding-data.html: Added.
+        * contentfiltering/allow-after-response-expected.html: Added.
+        * contentfiltering/allow-after-response.html: Added.
+        * contentfiltering/block-after-add-data-expected.html: Added.
+        * contentfiltering/block-after-add-data.html: Added.
+        * contentfiltering/block-after-finished-adding-data-expected.html: Added.
+        * contentfiltering/block-after-finished-adding-data.html: Added.
+        * contentfiltering/block-after-response-expected.html: Added.
+        * contentfiltering/block-after-response.html: Added.
+
</ins><span class="cx"> 2015-03-09  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         svg/custom/svg-fonts-without-missing-glyph.xhtml fails after fonts/font-fallback-prefers-pictographs.html
</span></span></pre></div>
<a id="trunkLayoutTestscontentfilteringallowafteradddataexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/contentfiltering/allow-after-add-data-expected.html (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/allow-after-add-data-expected.html                                (rev 0)
+++ trunk/LayoutTests/contentfiltering/allow-after-add-data-expected.html        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;iframe src=&quot;data:text/html,PASS&quot;&gt;&lt;/iframe&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringallowafteradddatahtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/contentfiltering/allow-after-add-data.html (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/allow-after-add-data.html                                (rev 0)
+++ trunk/LayoutTests/contentfiltering/allow-after-add-data.html        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;script&gt;
+var settings = window.internals.mockContentFilterSettings;
+settings.enabled = true;
+settings.blockedString = &quot;FAIL&quot;;
+settings.decisionPoint = settings.DECISION_POINT_AFTER_ADD_DATA;
+settings.decision = settings.DECISION_ALLOW;
+&lt;/script&gt;
+&lt;iframe src=&quot;data:text/html,PASS&quot;&gt;&lt;/iframe&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringallowafterfinishedaddingdataexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/contentfiltering/allow-after-finished-adding-data-expected.html (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/allow-after-finished-adding-data-expected.html                                (rev 0)
+++ trunk/LayoutTests/contentfiltering/allow-after-finished-adding-data-expected.html        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;iframe src=&quot;data:text/html,PASS&quot;&gt;&lt;/iframe&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringallowafterfinishedaddingdatahtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/contentfiltering/allow-after-finished-adding-data.html (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/allow-after-finished-adding-data.html                                (rev 0)
+++ trunk/LayoutTests/contentfiltering/allow-after-finished-adding-data.html        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;script&gt;
+var settings = window.internals.mockContentFilterSettings;
+settings.enabled = true;
+settings.blockedString = &quot;FAIL&quot;;
+settings.decisionPoint = settings.DECISION_POINT_AFTER_FINISHED_ADDING_DATA;
+settings.decision = settings.DECISION_ALLOW;
+&lt;/script&gt;
+&lt;iframe src=&quot;data:text/html,PASS&quot;&gt;&lt;/iframe&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringallowafterresponseexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/contentfiltering/allow-after-response-expected.html (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/allow-after-response-expected.html                                (rev 0)
+++ trunk/LayoutTests/contentfiltering/allow-after-response-expected.html        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;iframe src=&quot;data:text/html,PASS&quot;&gt;&lt;/iframe&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringallowafterresponsehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/contentfiltering/allow-after-response.html (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/allow-after-response.html                                (rev 0)
+++ trunk/LayoutTests/contentfiltering/allow-after-response.html        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;script&gt;
+var settings = window.internals.mockContentFilterSettings;
+settings.enabled = true;
+settings.blockedString = &quot;FAIL&quot;;
+settings.decisionPoint = settings.DECISION_POINT_AFTER_RESPONSE;
+settings.decision = settings.DECISION_ALLOW;
+&lt;/script&gt;
+&lt;iframe src=&quot;data:text/html,PASS&quot;&gt;&lt;/iframe&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafteradddataexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/contentfiltering/block-after-add-data-expected.html (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-add-data-expected.html                                (rev 0)
+++ trunk/LayoutTests/contentfiltering/block-after-add-data-expected.html        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;iframe src=&quot;data:text/html,&quot;&gt;&lt;/iframe&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafteradddatahtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/contentfiltering/block-after-add-data.html (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-add-data.html                                (rev 0)
+++ trunk/LayoutTests/contentfiltering/block-after-add-data.html        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;script&gt;
+var settings = window.internals.mockContentFilterSettings;
+settings.enabled = true;
+settings.blockedString = &quot;PASS&quot;;
+settings.decisionPoint = settings.DECISION_POINT_AFTER_ADD_DATA;
+settings.decision = settings.DECISION_BLOCK;
+&lt;/script&gt;
+&lt;iframe src=&quot;data:text/html,FAIL&quot;&gt;&lt;/iframe&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafterfinishedaddingdataexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/contentfiltering/block-after-finished-adding-data-expected.html (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-finished-adding-data-expected.html                                (rev 0)
+++ trunk/LayoutTests/contentfiltering/block-after-finished-adding-data-expected.html        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;iframe src=&quot;data:text/html,PASS&quot;&gt;&lt;/iframe&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafterfinishedaddingdatahtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/contentfiltering/block-after-finished-adding-data.html (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-finished-adding-data.html                                (rev 0)
+++ trunk/LayoutTests/contentfiltering/block-after-finished-adding-data.html        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;script&gt;
+var settings = window.internals.mockContentFilterSettings;
+settings.enabled = true;
+settings.blockedString = &quot;PASS&quot;;
+settings.decisionPoint = settings.DECISION_POINT_AFTER_FINISHED_ADDING_DATA;
+settings.decision = settings.DECISION_BLOCK;
+&lt;/script&gt;
+&lt;iframe src=&quot;data:text/html,FAIL&quot;&gt;&lt;/iframe&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafterresponseexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/contentfiltering/block-after-response-expected.html (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-response-expected.html                                (rev 0)
+++ trunk/LayoutTests/contentfiltering/block-after-response-expected.html        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;iframe src=&quot;data:text/html,FAIL&quot;&gt;&lt;/iframe&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscontentfilteringblockafterresponsehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/contentfiltering/block-after-response.html (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/contentfiltering/block-after-response.html                                (rev 0)
+++ trunk/LayoutTests/contentfiltering/block-after-response.html        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;script&gt;
+var settings = window.internals.mockContentFilterSettings;
+settings.enabled = true;
+settings.blockedString = &quot;PASS&quot;;
+settings.decisionPoint = settings.DECISION_POINT_AFTER_RESPONSE;
+settings.decision = settings.DECISION_BLOCK;
+&lt;/script&gt;
+&lt;iframe src=&quot;data:text/html,FAIL&quot;&gt;&lt;/iframe&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformeflTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/efl/TestExpectations (181290 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/efl/TestExpectations        2015-03-09 23:30:35 UTC (rev 181290)
+++ trunk/LayoutTests/platform/efl/TestExpectations        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -2155,3 +2155,6 @@
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/142483 fast/css/font-face-default-font.html [ Failure ]
</span><span class="cx"> webkit.org/b/142483 fast/css/font-face-in-media-rule.html [ Failure ]
</span><ins>+
+# This feature is only enabled on Mac and iOS right now
+contentfiltering [ Skip ]
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformgtkTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/TestExpectations (181290 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/TestExpectations        2015-03-09 23:30:35 UTC (rev 181290)
+++ trunk/LayoutTests/platform/gtk/TestExpectations        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -2372,3 +2372,6 @@
</span><span class="cx"> #////////////////////////////////////////////////////////////////////////////////////////
</span><span class="cx"> # End of Tests failing
</span><span class="cx"> #////////////////////////////////////////////////////////////////////////////////////////
</span><ins>+
+# This feature is only enabled on Mac and iOS right now
+contentfiltering [ Skip ]
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformwinTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/win/TestExpectations (181290 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/TestExpectations        2015-03-09 23:30:35 UTC (rev 181290)
+++ trunk/LayoutTests/platform/win/TestExpectations        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -3465,3 +3465,6 @@
</span><span class="cx"> ################################################################################
</span><span class="cx"> ######################### End list of UNREVIEWED failures ##########################
</span><span class="cx"> ################################################################################
</span><ins>+
+# This feature is only enabled on Mac and iOS right now
+contentfiltering [ Skip ]
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (181290 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-09 23:30:35 UTC (rev 181290)
+++ trunk/Source/WebCore/ChangeLog        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -1,3 +1,78 @@
</span><ins>+2015-03-09  Andy Estes  &lt;aestes@apple.com&gt;
+
+        [Content Filtering] Add tests
+        https://bugs.webkit.org/show_bug.cgi?id=142475
+
+        Reviewed by Andreas Kling.
+
+        Added a mock content filter that can be configured by window.internals. A test can control whether the filter
+        is enabled, what to display when a page is blocked, at what point the allow/block decision is made, and what
+        decision to make.
+
+        Added tests to cover allowing and blocking content at each decision point.
+
+        Tests: contentfiltering/allow-after-add-data.html
+               contentfiltering/allow-after-finished-adding-data.html
+               contentfiltering/allow-after-response.html
+               contentfiltering/block-after-add-data.html
+               contentfiltering/block-after-finished-adding-data.html
+               contentfiltering/block-after-response.html
+
+        * DerivedSources.make: Added MockContentFilterSettings.idl.
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSMockContentFilterSettingsCustom.cpp: Added.
+        (WebCore::JSMockContentFilterSettings::decisionPoint): Returned the decision point's JSValue.
+        (WebCore::JSMockContentFilterSettings::setDecisionPoint): Set the decision point; threw an exception for invalid values.
+        (WebCore::JSMockContentFilterSettings::decision): Returned the decision's JSValue.
+        (WebCore::JSMockContentFilterSettings::setDecision): Set the decision; threw an exception for invalid values.
+        * platform/ContentFilter.cpp:
+        (WebCore::ContentFilter::types): Renamed from contentFilterTypes.
+        (WebCore::ContentFilter::createIfNeeded):
+        (WebCore::contentFilterType): Deleted.
+        (WebCore::contentFilterTypes): Deleted.
+        * platform/ContentFilter.h:
+        (WebCore::ContentFilter::addType): Used to register a new content filter type.
+        (WebCore::ContentFilter::type): Renamed from contentFilterType.
+        * platform/cocoa/NetworkExtensionContentFilter.h: Moved definition of HAVE_NE_FILTER_SOURCE to here.
+        * testing/Internals.cpp:
+        (WebCore::Internals::resetToConsistentState): Called MockContentFilterSettings::reset().
+        (WebCore::Internals::Internals): Called MockContentFilter::ensureInstalled().
+        (WebCore::Internals::mockContentFilterSettings): Returned a reference to MockContentFilterSettings::singleton().
+        * testing/Internals.h:
+        * testing/Internals.idl: Added attribute mockContentFilterSettings.
+        * testing/MockContentFilter.cpp: Added.
+        (WebCore::MockContentFilter::ensureInstalled): Called MockContentFilter::addType().
+        (WebCore::MockContentFilter::canHandleResponse): Returned whether MockContentFilterSettings is enabled.
+        (WebCore::MockContentFilter::create): Returned a new MockContentFilter.
+        (WebCore::MockContentFilter::MockContentFilter): Called maybeDetermineStatus().
+        (WebCore::MockContentFilter::addData): Copied data into m_replacementData and called maybeDetermineStatus().
+        (WebCore::MockContentFilter::finishedAddingData): Called maybeDetermineStatus().
+        (WebCore::MockContentFilter::needsMoreData): Returned whether m_status equals NeedsMoreData.
+        (WebCore::MockContentFilter::didBlockData): Returned whether m_status equals Blocked.
+        (WebCore::MockContentFilter::getReplacementData): Returned a pointer to the start of m_replacementData.
+        (WebCore::MockContentFilter::unblockHandler): Returned an empty ContentFilterUnblockHandler.
+        (WebCore::MockContentFilter::maybeDetermineStatus): If m_status is NeedsMoreData and the current decision point
+        equals MockContentFilterSettings's decision point, set m_status according to MockContentFilterSettings's
+        decision. If m_status becomes Blocked, clear the original page data from m_replacementData and copy
+        MockContentFilterSettings's blocked string instead.
+        * testing/MockContentFilter.h: Copied from Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.h.
+        * testing/MockContentFilterSettings.cpp: Copied from Source/WebCore/platform/ContentFilter.h.
+        (WebCore::MockContentFilterSettings::singleton):
+        (WebCore::MockContentFilterSettings::reset): Reset settings to their initial values.
+        (WebCore::MockContentFilterSettings::MockContentFilterSettings):
+        * testing/MockContentFilterSettings.h: Copied from Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.h.
+        (WebCore::MockContentFilterSettings::ref): Added an empty implementation to make the bindings think this is RefCounted.
+        (WebCore::MockContentFilterSettings::deref): Ditto.
+        (WebCore::MockContentFilterSettings::enabled):
+        (WebCore::MockContentFilterSettings::setEnabled):
+        (WebCore::MockContentFilterSettings::blockedString):
+        (WebCore::MockContentFilterSettings::setBlockedString):
+        (WebCore::MockContentFilterSettings::decisionPoint):
+        (WebCore::MockContentFilterSettings::setDecisionPoint):
+        (WebCore::MockContentFilterSettings::decision):
+        (WebCore::MockContentFilterSettings::setDecision):
+        * testing/MockContentFilterSettings.idl: Copied from Source/WebCore/platform/ContentFilter.h.
+
</ins><span class="cx"> 2015-03-09  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Simple line layout should not be limited to RenderText.
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources.make (181290 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources.make        2015-03-09 23:30:35 UTC (rev 181290)
+++ trunk/Source/WebCore/DerivedSources.make        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -509,6 +509,7 @@
</span><span class="cx">     $(WebCore)/testing/InternalSettings.idl \
</span><span class="cx">     $(WebCore)/testing/MallocStatistics.idl \
</span><span class="cx">     $(WebCore)/testing/MemoryInfo.idl \
</span><ins>+    $(WebCore)/testing/MockContentFilterSettings.idl \
</ins><span class="cx">     $(WebCore)/testing/TypeConversions.idl \
</span><span class="cx">     $(WebCore)/workers/AbstractWorker.idl \
</span><span class="cx">     $(WebCore)/workers/DedicatedWorkerGlobalScope.idl \
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (181290 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-03-09 23:30:35 UTC (rev 181290)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -3807,10 +3807,16 @@
</span><span class="cx">                 A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */; };
</span><span class="cx">                 A18890AE1AA13F250026C301 /* ParentalControlsContentFilter.mm in Sources */ = {isa = PBXBuildFile; fileRef = A18890AC1AA13F250026C301 /* ParentalControlsContentFilter.mm */; };
</span><span class="cx">                 A18890AF1AA13F250026C301 /* ParentalControlsContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A18890AD1AA13F250026C301 /* ParentalControlsContentFilter.h */; };
</span><ins>+                A19AEA211AAA808600B52B25 /* JSMockContentFilterSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = A19AEA1E1AAA806E00B52B25 /* JSMockContentFilterSettings.h */; };
+                A19AEA221AAA808A00B52B25 /* JSMockContentFilterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A19AEA1D1AAA806E00B52B25 /* JSMockContentFilterSettings.cpp */; };
</ins><span class="cx">                 A19D93461A9FEC7200B46C24 /* NEFilterSourceSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A19D93441A9FEC7200B46C24 /* NEFilterSourceSPI.h */; };
</span><span class="cx">                 A19D93471A9FEC7200B46C24 /* WebFilterEvaluatorSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A19D93451A9FEC7200B46C24 /* WebFilterEvaluatorSPI.h */; };
</span><span class="cx">                 A19D934A1AA11B1E00B46C24 /* NetworkExtensionContentFilter.mm in Sources */ = {isa = PBXBuildFile; fileRef = A19D93481AA11B1E00B46C24 /* NetworkExtensionContentFilter.mm */; };
</span><span class="cx">                 A19D934B1AA11B1E00B46C24 /* NetworkExtensionContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A19D93491AA11B1E00B46C24 /* NetworkExtensionContentFilter.h */; };
</span><ins>+                A1B5B29E1AAA846E008B6042 /* MockContentFilterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1B5B29C1AAA846E008B6042 /* MockContentFilterSettings.cpp */; };
+                A1B5B29F1AAA846F008B6042 /* MockContentFilterSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = A1B5B29D1AAA846E008B6042 /* MockContentFilterSettings.h */; };
+                A1BF6B821AA96C7D00AF4A8A /* MockContentFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1BF6B801AA96C7D00AF4A8A /* MockContentFilter.cpp */; };
+                A1BF6B831AA96C7D00AF4A8A /* MockContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BF6B811AA96C7D00AF4A8A /* MockContentFilter.h */; };
</ins><span class="cx">                 A1C797181883DD82000F5E1F /* DOMGestureEvent.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 0F54DCDD1880F901003EEDBB /* DOMGestureEvent.h */; };
</span><span class="cx">                 A1C797191883DDED000F5E1F /* DOMTouch.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 0F54DCCD1880F867003EEDBB /* DOMTouch.h */; };
</span><span class="cx">                 A1C7971A1883DE0D000F5E1F /* DOMTouchEvent.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 0F54DCCF1880F867003EEDBB /* DOMTouchEvent.h */; };
</span><span class="lines">@@ -3823,6 +3829,7 @@
</span><span class="cx">                 A1E1154413015C3D0054AC8C /* DistantLightSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1E1154313015C3D0054AC8C /* DistantLightSource.cpp */; };
</span><span class="cx">                 A1E1154613015C4E0054AC8C /* PointLightSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1E1154513015C4E0054AC8C /* PointLightSource.cpp */; };
</span><span class="cx">                 A1E1154813015C5D0054AC8C /* SpotLightSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1E1154713015C5D0054AC8C /* SpotLightSource.cpp */; };
</span><ins>+                A1E5B31F1AAD1DA4006EBEFB /* JSMockContentFilterSettingsCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1E5B31D1AAD1DA4006EBEFB /* JSMockContentFilterSettingsCustom.cpp */; };
</ins><span class="cx">                 A2B9217316C5CC420041DCD9 /* IntRectExtent.h in Headers */ = {isa = PBXBuildFile; fileRef = A2B9217216C5CC420041DCD9 /* IntRectExtent.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A31C4E4D16E02AA6002F7957 /* OESTextureHalfFloat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A31C4E4C16E02AA6002F7957 /* OESTextureHalfFloat.cpp */; };
</span><span class="cx">                 A31C4E4F16E02AB4002F7957 /* OESTextureHalfFloat.h in Headers */ = {isa = PBXBuildFile; fileRef = A31C4E4E16E02AB4002F7957 /* OESTextureHalfFloat.h */; };
</span><span class="lines">@@ -11042,10 +11049,17 @@
</span><span class="cx">                 A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLElementFactory.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A18890AC1AA13F250026C301 /* ParentalControlsContentFilter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ParentalControlsContentFilter.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A18890AD1AA13F250026C301 /* ParentalControlsContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParentalControlsContentFilter.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                A19AEA1C1AAA7C4900B52B25 /* MockContentFilterSettings.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MockContentFilterSettings.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
+                A19AEA1D1AAA806E00B52B25 /* JSMockContentFilterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMockContentFilterSettings.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                A19AEA1E1AAA806E00B52B25 /* JSMockContentFilterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMockContentFilterSettings.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 A19D93441A9FEC7200B46C24 /* NEFilterSourceSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NEFilterSourceSPI.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A19D93451A9FEC7200B46C24 /* WebFilterEvaluatorSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFilterEvaluatorSPI.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A19D93481AA11B1E00B46C24 /* NetworkExtensionContentFilter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkExtensionContentFilter.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A19D93491AA11B1E00B46C24 /* NetworkExtensionContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkExtensionContentFilter.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                A1B5B29C1AAA846E008B6042 /* MockContentFilterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockContentFilterSettings.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                A1B5B29D1AAA846E008B6042 /* MockContentFilterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockContentFilterSettings.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                A1BF6B801AA96C7D00AF4A8A /* MockContentFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockContentFilter.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                A1BF6B811AA96C7D00AF4A8A /* MockContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockContentFilter.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 A1C7971C1883E51F000F5E1F /* DOMHTMLTextAreaElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLTextAreaElementPrivate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A1C7FAA1133A5D3500D6732D /* JSXPathResultCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXPathResultCustom.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A1DE712B18612AC100734192 /* TouchEvents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TouchEvents.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -11053,6 +11067,7 @@
</span><span class="cx">                 A1E1154313015C3D0054AC8C /* DistantLightSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DistantLightSource.cpp; path = filters/DistantLightSource.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A1E1154513015C4E0054AC8C /* PointLightSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PointLightSource.cpp; path = filters/PointLightSource.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A1E1154713015C5D0054AC8C /* SpotLightSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SpotLightSource.cpp; path = filters/SpotLightSource.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                A1E5B31D1AAD1DA4006EBEFB /* JSMockContentFilterSettingsCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMockContentFilterSettingsCustom.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 A208E222A56A0C7575F2A72E /* RenderMathMLMenclose.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLMenclose.h; path = rendering/mathml/RenderMathMLMenclose.h; sourceTree = SOURCE_ROOT; };
</span><span class="cx">                 A2B9217216C5CC420041DCD9 /* IntRectExtent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntRectExtent.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A31C4E4C16E02AA6002F7957 /* OESTextureHalfFloat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OESTextureHalfFloat.cpp; path = canvas/OESTextureHalfFloat.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -15717,6 +15732,11 @@
</span><span class="cx">                                 CD5393CC175DCCE600C07123 /* MemoryInfo.idl */,
</span><span class="cx">                                 CDC26B3C160A62B00026757B /* MockCDM.cpp */,
</span><span class="cx">                                 CDC26B3D160A62B00026757B /* MockCDM.h */,
</span><ins>+                                A1BF6B801AA96C7D00AF4A8A /* MockContentFilter.cpp */,
+                                A1BF6B811AA96C7D00AF4A8A /* MockContentFilter.h */,
+                                A1B5B29C1AAA846E008B6042 /* MockContentFilterSettings.cpp */,
+                                A1B5B29D1AAA846E008B6042 /* MockContentFilterSettings.h */,
+                                A19AEA1C1AAA7C4900B52B25 /* MockContentFilterSettings.idl */,
</ins><span class="cx">                                 2DAAE32C19DCAF6000E002D2 /* MockPageOverlayClient.cpp */,
</span><span class="cx">                                 2DAAE32D19DCAF6000E002D2 /* MockPageOverlayClient.h */,
</span><span class="cx">                                 EB081CD81696084400553730 /* TypeConversions.h */,
</span><span class="lines">@@ -15739,6 +15759,8 @@
</span><span class="cx">                                 A7B4EA6914C9348400C8F5BF /* JSMallocStatistics.h */,
</span><span class="cx">                                 CD5393D1175E018600C07123 /* JSMemoryInfo.cpp */,
</span><span class="cx">                                 CD5393D2175E018600C07123 /* JSMemoryInfo.h */,
</span><ins>+                                A19AEA1D1AAA806E00B52B25 /* JSMockContentFilterSettings.cpp */,
+                                A19AEA1E1AAA806E00B52B25 /* JSMockContentFilterSettings.h */,
</ins><span class="cx">                                 EBF5121A1696496C0056BD25 /* JSTypeConversions.cpp */,
</span><span class="cx">                                 EBF5121B1696496C0056BD25 /* JSTypeConversions.h */,
</span><span class="cx">                         );
</span><span class="lines">@@ -21144,6 +21166,7 @@
</span><span class="cx">                                 410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */,
</span><span class="cx">                                 E1ADED460E76B8DD004A1A5E /* JSMessagePortCustom.cpp */,
</span><span class="cx">                                 41F584C6104652CB009CAA64 /* JSMessagePortCustom.h */,
</span><ins>+                                A1E5B31D1AAD1DA4006EBEFB /* JSMockContentFilterSettingsCustom.cpp */,
</ins><span class="cx">                                 C6F0917E143A2BB900685849 /* JSMutationObserverCustom.cpp */,
</span><span class="cx">                                 BCD9C25F0C17AA67005C90A2 /* JSNamedNodeMapCustom.cpp */,
</span><span class="cx">                                 073794E719EE335C00E5A045 /* JSNavigatorCustom.cpp */,
</span><span class="lines">@@ -23483,15 +23506,18 @@
</span><span class="cx">                         files = (
</span><span class="cx">                                 417DA6DA13734E6E007C57FB /* Internals.h in Headers */,
</span><span class="cx">                                 A7BF7EE014C9175A0014489D /* InternalSettings.h in Headers */,
</span><ins>+                                A1B5B29F1AAA846F008B6042 /* MockContentFilterSettings.h in Headers */,
</ins><span class="cx">                                 53E29E5F167A8A1900586D3D /* InternalSettingsGenerated.h in Headers */,
</span><span class="cx">                                 417DA71E13735DFA007C57FB /* JSInternals.h in Headers */,
</span><span class="cx">                                 A740B5A514C935AB00A77FA4 /* JSInternalSettings.h in Headers */,
</span><span class="cx">                                 53ED3FDF167A88E7006762E6 /* JSInternalSettingsGenerated.h in Headers */,
</span><span class="cx">                                 A740B59514C935AB00A77FA4 /* JSMallocStatistics.h in Headers */,
</span><ins>+                                A1BF6B831AA96C7D00AF4A8A /* MockContentFilter.h in Headers */,
</ins><span class="cx">                                 CD5393D4175E018600C07123 /* JSMemoryInfo.h in Headers */,
</span><span class="cx">                                 CB8CF01D1A95DE42000D510B /* MicroTaskTest.h in Headers */,
</span><span class="cx">                                 EBF5121D1696496C0056BD25 /* JSTypeConversions.h in Headers */,
</span><span class="cx">                                 CDC26B41160A8CCE0026757B /* MockCDM.h in Headers */,
</span><ins>+                                A19AEA211AAA808600B52B25 /* JSMockContentFilterSettings.h in Headers */,
</ins><span class="cx">                                 2D97F04819DD4140001EE9C3 /* MockPageOverlayClient.h in Headers */,
</span><span class="cx">                                 AA5F3B8D16CC33D100455EB0 /* PlatformSpeechSynthesizerMock.h in Headers */,
</span><span class="cx">                                 41815C1F138319830057AAA4 /* WebCoreTestSupport.h in Headers */,
</span><span class="lines">@@ -27248,8 +27274,12 @@
</span><span class="cx">                                 A740B5A714C935AF00A77FA4 /* JSInternalSettings.cpp in Sources */,
</span><span class="cx">                                 CB8CF01F1A95DE59000D510B /* MicroTaskTest.cpp in Sources */,
</span><span class="cx">                                 53ED3FDE167A88E7006762E6 /* JSInternalSettingsGenerated.cpp in Sources */,
</span><ins>+                                A1E5B31F1AAD1DA4006EBEFB /* JSMockContentFilterSettingsCustom.cpp in Sources */,
+                                A1B5B29E1AAA846E008B6042 /* MockContentFilterSettings.cpp in Sources */,
</ins><span class="cx">                                 A740B59714C935AF00A77FA4 /* JSMallocStatistics.cpp in Sources */,
</span><span class="cx">                                 CD5393D3175E018600C07123 /* JSMemoryInfo.cpp in Sources */,
</span><ins>+                                A19AEA221AAA808A00B52B25 /* JSMockContentFilterSettings.cpp in Sources */,
+                                A1BF6B821AA96C7D00AF4A8A /* MockContentFilter.cpp in Sources */,
</ins><span class="cx">                                 EBF5121C1696496C0056BD25 /* JSTypeConversions.cpp in Sources */,
</span><span class="cx">                                 CDC26B40160A8CC60026757B /* MockCDM.cpp in Sources */,
</span><span class="cx">                                 2D97F04719DD413C001EE9C3 /* MockPageOverlayClient.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSMockContentFilterSettingsCustomcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/bindings/js/JSMockContentFilterSettingsCustom.cpp (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSMockContentFilterSettingsCustom.cpp                                (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSMockContentFilterSettingsCustom.cpp        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,114 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;JSMockContentFilterSettings.h&quot;
+
+#if ENABLE(CONTENT_FILTERING)
+
+#include &quot;JSDOMBinding.h&quot;
+#include &quot;MockContentFilterSettings.h&quot;
+
+using namespace JSC;
+
+namespace WebCore {
+
+// Must be kept in sync with values in MockContentFilterSettings.idl.
+const uint8_t decisionPointAfterResponse = 0;
+const uint8_t decisionPointAfterAddData = 1;
+const uint8_t decisionPointAfterFinishedAddingData = 2;
+const uint8_t decisionAllow = 0;
+const uint8_t decisionBlock = 1;
+
+JSC::JSValue JSMockContentFilterSettings::decisionPoint(JSC::ExecState*) const
+{
+    switch (impl().decisionPoint()) {
+    case MockContentFilterSettings::DecisionPoint::AfterResponse:
+        return jsNumber(decisionPointAfterResponse);
+    case MockContentFilterSettings::DecisionPoint::AfterAddData:
+        return jsNumber(decisionPointAfterAddData);
+    case MockContentFilterSettings::DecisionPoint::AfterFinishedAddingData:
+        return jsNumber(decisionPointAfterFinishedAddingData);
+    }
+
+    ASSERT_NOT_REACHED();
+    return { };
+}
+
+void JSMockContentFilterSettings::setDecisionPoint(JSC::ExecState* exec, JSC::JSValue value)
+{
+    uint8_t nativeValue { toUInt8(exec, value, EnforceRange) };
+    if (exec-&gt;hadException())
+        return;
+
+    switch (nativeValue) {
+    case decisionPointAfterResponse:
+        impl().setDecisionPoint(MockContentFilterSettings::DecisionPoint::AfterResponse);
+        return;
+    case decisionPointAfterAddData:
+        impl().setDecisionPoint(MockContentFilterSettings::DecisionPoint::AfterAddData);
+        return;
+    case decisionPointAfterFinishedAddingData:
+        impl().setDecisionPoint(MockContentFilterSettings::DecisionPoint::AfterFinishedAddingData);
+        return;
+    default:
+        throwTypeError(exec, String::format(&quot;%u is not a valid decisionPoint value.&quot;, nativeValue));
+    }
+}
+
+JSC::JSValue JSMockContentFilterSettings::decision(JSC::ExecState*) const
+{
+    switch (impl().decision()) {
+    case MockContentFilterSettings::Decision::Allow:
+        return jsNumber(decisionAllow);
+    case MockContentFilterSettings::Decision::Block:
+        return jsNumber(decisionBlock);
+    }
+
+    ASSERT_NOT_REACHED();
+    return { };
+}
+
+void JSMockContentFilterSettings::setDecision(JSC::ExecState* exec, JSC::JSValue value)
+{
+    uint8_t nativeValue { toUInt8(exec, value, EnforceRange) };
+    if (exec-&gt;hadException())
+        return;
+
+    switch (nativeValue) {
+    case decisionAllow:
+        impl().setDecision(MockContentFilterSettings::Decision::Allow);
+        return;
+    case decisionBlock:
+        impl().setDecision(MockContentFilterSettings::Decision::Block);
+        return;
+    default:
+        throwTypeError(exec, String::format(&quot;%u is not a valid decision value.&quot;, nativeValue));
+    }
+}
+
+}; // namespace WebCore
+
+#endif // ENABLE(CONTENT_FILTERING)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformContentFiltercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ContentFilter.cpp (181290 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ContentFilter.cpp        2015-03-09 23:30:35 UTC (rev 181290)
+++ trunk/Source/WebCore/platform/ContentFilter.cpp        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -35,27 +35,16 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-struct ContentFilterType {
-    const std::function&lt;bool(const ResourceResponse&amp;)&gt; canHandleResponse;
-    const std::function&lt;std::unique_ptr&lt;ContentFilter&gt;(const ResourceResponse&amp;)&gt; create;
-};
-
-template &lt;typename T&gt;
-static inline ContentFilterType contentFilterType()
</del><ins>+Vector&lt;ContentFilter::Type&gt;&amp; ContentFilter::types()
</ins><span class="cx"> {
</span><del>-    return { T::canHandleResponse, T::create };
-}
-
-static const Vector&lt;ContentFilterType&gt;&amp; contentFilterTypes()
-{
-    static NeverDestroyed&lt;Vector&lt;ContentFilterType&gt;&gt; types(
-        Vector&lt;ContentFilterType&gt;({
-            contentFilterType&lt;ParentalControlsContentFilter&gt;(),
</del><ins>+    static NeverDestroyed&lt;Vector&lt;ContentFilter::Type&gt;&gt; types {
+        Vector&lt;ContentFilter::Type&gt; {
+            type&lt;ParentalControlsContentFilter&gt;(),
</ins><span class="cx"> #if HAVE(NE_FILTER_SOURCE)
</span><del>-            contentFilterType&lt;NetworkExtensionContentFilter&gt;()
</del><ins>+            type&lt;NetworkExtensionContentFilter&gt;()
</ins><span class="cx"> #endif
</span><del>-        })
-    );
</del><ins>+        }
+    };
</ins><span class="cx">     return types;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -79,7 +68,7 @@
</span><span class="cx"> std::unique_ptr&lt;ContentFilter&gt; ContentFilter::createIfNeeded(const ResourceResponse&amp; response)
</span><span class="cx"> {
</span><span class="cx">     ContentFilterCollection::Container filters;
</span><del>-    for (auto&amp; type : contentFilterTypes()) {
</del><ins>+    for (auto&amp; type : types()) {
</ins><span class="cx">         if (type.canHandleResponse(response))
</span><span class="cx">             filters.append(type.create(response));
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformContentFilterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ContentFilter.h (181290 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ContentFilter.h        2015-03-09 23:30:35 UTC (rev 181290)
+++ trunk/Source/WebCore/platform/ContentFilter.h        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -29,25 +29,33 @@
</span><span class="cx"> #if ENABLE(CONTENT_FILTERING)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ContentFilterUnblockHandler.h&quot;
</span><ins>+#include &lt;wtf/Vector.h&gt;
</ins><span class="cx"> 
</span><del>-#define HAVE_NE_FILTER_SOURCE TARGET_OS_EMBEDDED || (!TARGET_OS_IPHONE &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000 &amp;&amp; CPU(X86_64))
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class ResourceResponse;
</span><span class="cx"> 
</span><span class="cx"> class ContentFilter {
</span><span class="cx"> public:
</span><ins>+    template &lt;typename T&gt; static void addType() { types().append(type&lt;T&gt;()); }
+
</ins><span class="cx">     static std::unique_ptr&lt;ContentFilter&gt; createIfNeeded(const ResourceResponse&amp;);
</span><span class="cx"> 
</span><span class="cx">     virtual ~ContentFilter() { }
</span><del>-
</del><span class="cx">     virtual void addData(const char* data, int length) = 0;
</span><span class="cx">     virtual void finishedAddingData() = 0;
</span><span class="cx">     virtual bool needsMoreData() const = 0;
</span><span class="cx">     virtual bool didBlockData() const = 0;
</span><span class="cx">     virtual const char* getReplacementData(int&amp; length) const = 0;
</span><span class="cx">     virtual ContentFilterUnblockHandler unblockHandler() const = 0;
</span><ins>+
+private:
+    struct Type {
+        const std::function&lt;bool(const ResourceResponse&amp;)&gt; canHandleResponse;
+        const std::function&lt;std::unique_ptr&lt;ContentFilter&gt;(const ResourceResponse&amp;)&gt; create;
+    };
+    template &lt;typename T&gt; static Type type() { return { T::canHandleResponse, T::create }; }
+    WEBCORE_EXPORT static Vector&lt;Type&gt;&amp; types();
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaNetworkExtensionContentFilterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.h (181290 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.h        2015-03-09 23:30:35 UTC (rev 181290)
+++ trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.h        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -30,6 +30,8 @@
</span><span class="cx"> #include &lt;wtf/Compiler.h&gt;
</span><span class="cx"> #include &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><ins>+#define HAVE_NE_FILTER_SOURCE TARGET_OS_EMBEDDED || (!TARGET_OS_IPHONE &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000 &amp;&amp; CPU(X86_64))
+
</ins><span class="cx"> OBJC_CLASS NEFilterSource;
</span><span class="cx"> OBJC_CLASS NSMutableData;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (181290 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2015-03-09 23:30:35 UTC (rev 181290)
+++ trunk/Source/WebCore/testing/Internals.cpp        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -175,6 +175,10 @@
</span><span class="cx"> #include &quot;DictionaryLookup.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(CONTENT_FILTERING)
+#include &quot;MockContentFilter.h&quot;
+#endif
+
</ins><span class="cx"> using JSC::CodeBlock;
</span><span class="cx"> using JSC::FunctionExecutable;
</span><span class="cx"> using JSC::JSFunction;
</span><span class="lines">@@ -314,6 +318,10 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     MockPageOverlayClient::singleton().uninstallAllOverlays();
</span><ins>+
+#if ENABLE(CONTENT_FILTERING)
+    MockContentFilterSettings::reset();
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Internals::Internals(Document* document)
</span><span class="lines">@@ -329,6 +337,10 @@
</span><span class="cx">     enableMockRTCPeerConnectionHandler();
</span><span class="cx">     WebCore::provideUserMediaTo(document-&gt;page(), new UserMediaClientMock());
</span><span class="cx"> #endif
</span><ins>+
+#if ENABLE(CONTENT_FILTERING)
+    MockContentFilter::ensureInstalled();
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Document* Internals::contextDocument() const
</span><span class="lines">@@ -2540,4 +2552,11 @@
</span><span class="cx">         MicroTaskQueue::singleton().queueMicroTask(MicroTaskTest::create(contextDocument()-&gt;createWeakPtr(), testNumber));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(CONTENT_FILTERING)
+MockContentFilterSettings&amp; Internals::mockContentFilterSettings()
+{
+    return MockContentFilterSettings::singleton();
</ins><span class="cx"> }
</span><ins>+#endif
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.h (181290 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.h        2015-03-09 23:30:35 UTC (rev 181290)
+++ trunk/Source/WebCore/testing/Internals.h        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -65,6 +65,10 @@
</span><span class="cx"> class TypeConversions;
</span><span class="cx"> class XMLHttpRequest;
</span><span class="cx"> 
</span><ins>+#if ENABLE(CONTENT_FILTERING)
+class MockContentFilterSettings;
+#endif
+
</ins><span class="cx"> typedef int ExceptionCode;
</span><span class="cx"> 
</span><span class="cx"> class Internals : public RefCounted&lt;Internals&gt;
</span><span class="lines">@@ -368,6 +372,10 @@
</span><span class="cx">     RefPtr&lt;File&gt; createFile(const String&amp;);
</span><span class="cx">     void queueMicroTask(int);
</span><span class="cx"> 
</span><ins>+#if ENABLE(CONTENT_FILTERING)
+    MockContentFilterSettings&amp; mockContentFilterSettings();
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     explicit Internals(Document*);
</span><span class="cx">     Document* contextDocument() const;
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.idl (181290 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.idl        2015-03-09 23:30:35 UTC (rev 181290)
+++ trunk/Source/WebCore/testing/Internals.idl        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -323,4 +323,6 @@
</span><span class="cx">     
</span><span class="cx">     File createFile(DOMString url);
</span><span class="cx">     void queueMicroTask(long testNumber);
</span><ins>+
+    [Conditional=CONTENT_FILTERING] readonly attribute MockContentFilterSettings mockContentFilterSettings;
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoretestingMockContentFiltercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/testing/MockContentFilter.cpp (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockContentFilter.cpp                                (rev 0)
+++ trunk/Source/WebCore/testing/MockContentFilter.cpp        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,107 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;MockContentFilter.h&quot;
+
+#if ENABLE(CONTENT_FILTERING)
+
+#include &lt;mutex&gt;
+#include &lt;wtf/text/CString.h&gt;
+
+namespace WebCore {
+
+void MockContentFilter::ensureInstalled()
+{
+    static std::once_flag onceFlag;
+    std::call_once(onceFlag, []{
+        ContentFilter::addType&lt;MockContentFilter&gt;();
+    });
+}
+
+bool MockContentFilter::canHandleResponse(const ResourceResponse&amp;)
+{
+    return MockContentFilterSettings::singleton().enabled();
+}
+
+std::unique_ptr&lt;MockContentFilter&gt; MockContentFilter::create(const ResourceResponse&amp; response)
+{
+    return std::make_unique&lt;MockContentFilter&gt;(response);
+}
+
+MockContentFilter::MockContentFilter(const ResourceResponse&amp;)
+{
+    maybeDetermineStatus(MockContentFilterSettings::DecisionPoint::AfterResponse);
+}
+
+void MockContentFilter::addData(const char* data, int length)
+{
+    m_replacementData.append(data, length);
+    maybeDetermineStatus(MockContentFilterSettings::DecisionPoint::AfterAddData);
+}
+
+void MockContentFilter::finishedAddingData()
+{
+    maybeDetermineStatus(MockContentFilterSettings::DecisionPoint::AfterFinishedAddingData);
+}
+
+bool MockContentFilter::needsMoreData() const
+{
+    return m_status == Status::NeedsMoreData;
+}
+
+bool MockContentFilter::didBlockData() const
+{
+    return m_status == Status::Blocked;
+}
+
+const char* MockContentFilter::getReplacementData(int&amp; length) const
+{
+    length = m_replacementData.size();
+    return m_replacementData.data();
+}
+
+ContentFilterUnblockHandler MockContentFilter::unblockHandler() const
+{
+    return { };
+}
+
+void MockContentFilter::maybeDetermineStatus(MockContentFilterSettings::DecisionPoint decisionPoint)
+{
+    if (m_status != Status::NeedsMoreData || decisionPoint != MockContentFilterSettings::singleton().decisionPoint())
+        return;
+
+    m_status = MockContentFilterSettings::singleton().decision() == MockContentFilterSettings::Decision::Allow ? Status::Allowed : Status::Blocked;
+    if (m_status != Status::Blocked)
+        return;
+
+    m_replacementData.clear();
+    const CString utf8BlockedString = MockContentFilterSettings::singleton().blockedString().utf8();
+    m_replacementData.append(utf8BlockedString.data(), utf8BlockedString.length());
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_FILTERING)
</ins></span></pre></div>
<a id="trunkSourceWebCoretestingMockContentFilterhfromrev181290trunkSourceWebCoreplatformcocoaNetworkExtensionContentFilterh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/testing/MockContentFilter.h (from rev 181290, trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.h) (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockContentFilter.h                                (rev 0)
+++ trunk/Source/WebCore/testing/MockContentFilter.h        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MockContentFilter_h
+#define MockContentFilter_h
+
+#include &quot;ContentFilter.h&quot;
+#include &quot;MockContentFilterSettings.h&quot;
+
+namespace WebCore {
+
+class MockContentFilter final : public ContentFilter {
+    WTF_MAKE_NONCOPYABLE(MockContentFilter);
+    WTF_MAKE_FAST_ALLOCATED;
+    friend std::unique_ptr&lt;MockContentFilter&gt; std::make_unique&lt;MockContentFilter&gt;(const ResourceResponse&amp;);
+public:
+    static void ensureInstalled();
+    static bool canHandleResponse(const ResourceResponse&amp;);
+    static std::unique_ptr&lt;MockContentFilter&gt; create(const ResourceResponse&amp;);
+
+    void addData(const char* data, int length) override;
+    void finishedAddingData() override;
+    bool needsMoreData() const override;
+    bool didBlockData() const override;
+    const char* getReplacementData(int&amp; length) const override;
+    ContentFilterUnblockHandler unblockHandler() const override;
+
+private:
+    enum class Status {
+        NeedsMoreData,
+        Allowed,
+        Blocked
+    };
+
+    explicit MockContentFilter(const ResourceResponse&amp;);
+    void maybeDetermineStatus(MockContentFilterSettings::DecisionPoint);
+
+    Vector&lt;char&gt; m_replacementData;
+    Status m_status { Status::NeedsMoreData };
+};
+
+} // namespace WebCore
+
+#endif // MockContentFilter_h
</ins></span></pre></div>
<a id="trunkSourceWebCoretestingMockContentFilterSettingscppfromrev181290trunkSourceWebCoreplatformContentFilterh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/testing/MockContentFilterSettings.cpp (from rev 181290, trunk/Source/WebCore/platform/ContentFilter.h) (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockContentFilterSettings.cpp                                (rev 0)
+++ trunk/Source/WebCore/testing/MockContentFilterSettings.cpp        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;MockContentFilterSettings.h&quot;
+
+#if ENABLE(CONTENT_FILTERING)
+
+#include &lt;wtf/NeverDestroyed.h&gt;
+
+namespace WebCore {
+
+MockContentFilterSettings&amp; MockContentFilterSettings::singleton()
+{
+    static NeverDestroyed&lt;MockContentFilterSettings&gt; settings;
+    return settings;
+}
+
+void MockContentFilterSettings::reset()
+{
+    singleton() = MockContentFilterSettings();
+}
+
+}; // namespace WebCore
+
+#endif // ENABLE(CONTENT_FILTERING)
</ins></span></pre></div>
<a id="trunkSourceWebCoretestingMockContentFilterSettingsh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/testing/MockContentFilterSettings.h (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockContentFilterSettings.h                                (rev 0)
+++ trunk/Source/WebCore/testing/MockContentFilterSettings.h        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MockContentFilterSettings_h
+#define MockContentFilterSettings_h
+
+#include &lt;wtf/NeverDestroyed.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace WebCore {
+
+class MockContentFilterSettings {
+    WTF_MAKE_FAST_ALLOCATED;
+    friend class NeverDestroyed&lt;MockContentFilterSettings&gt;;
+public:
+    enum class DecisionPoint {
+        AfterResponse,
+        AfterAddData,
+        AfterFinishedAddingData
+    };
+
+    enum class Decision {
+        Allow,
+        Block
+    };
+
+    static MockContentFilterSettings&amp; singleton();
+    static void reset();
+
+    // Trick the generated bindings into thinking we're RefCounted.
+    void ref() { }
+    void deref() { }
+
+    bool enabled() const { return m_enabled; }
+    void setEnabled(bool enabled) { m_enabled = enabled; }
+
+    const String&amp; blockedString() const { return m_blockedString; }
+    void setBlockedString(const String&amp; blockedString) { m_blockedString = blockedString; }
+
+    DecisionPoint decisionPoint() const { return m_decisionPoint; }
+    void setDecisionPoint(DecisionPoint decisionPoint) { m_decisionPoint = decisionPoint; }
+
+    Decision decision() const { return m_decision; }
+    void setDecision(Decision decision) { m_decision = decision; }
+
+private:
+    MockContentFilterSettings() = default;
+    MockContentFilterSettings(const MockContentFilterSettings&amp;) = delete;
+    MockContentFilterSettings&amp; operator=(const MockContentFilterSettings&amp;) = default;
+
+    bool m_enabled { false };
+    DecisionPoint m_decisionPoint { DecisionPoint::AfterResponse };
+    Decision m_decision { Decision::Allow };
+    String m_blockedString;
+};
+
+} // namespace WebCore
+
+#endif // MockContentFilterSettings_h
</ins></span></pre></div>
<a id="trunkSourceWebCoretestingMockContentFilterSettingsidlfromrev181290trunkSourceWebCoreplatformContentFilterh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/testing/MockContentFilterSettings.idl (from rev 181290, trunk/Source/WebCore/platform/ContentFilter.h) (0 => 181291)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockContentFilterSettings.idl                                (rev 0)
+++ trunk/Source/WebCore/testing/MockContentFilterSettings.idl        2015-03-09 23:39:05 UTC (rev 181291)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Conditional=CONTENT_FILTERING,
+    NoInterfaceObject,
+    ImplementationLacksVTable
+] interface MockContentFilterSettings {
+    attribute boolean enabled;
+    attribute DOMString blockedString;
+
+    const octet DECISION_POINT_AFTER_RESPONSE = 0;
+    const octet DECISION_POINT_AFTER_ADD_DATA = 1;
+    const octet DECISION_POINT_AFTER_FINISHED_ADDING_DATA = 2;
+    [Custom] attribute octet decisionPoint;
+
+    const octet DECISION_ALLOW = 0;
+    const octet DECISION_BLOCK = 1;
+    [Custom] attribute octet decision;
+};
</ins></span></pre>
</div>
</div>

</body>
</html>