<!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>[180783] 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/180783">180783</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2015-02-27 14:50:03 -0800 (Fri, 27 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add a &quot;block-cookies&quot; rule to the user content filter.
https://bugs.webkit.org/show_bug.cgi?id=142105

Reviewed by Alex Christensen.

Source/WebCore:

Tests: http/tests/usercontentfilter/block-cookies-basic.html
       http/tests/usercontentfilter/block-cookies-send.html

* contentextensions/ContentExtensionRule.h:

* contentextensions/ContentExtensionsBackend.cpp:
(WebCore::ContentExtensions::ContentExtensionsBackend::actionForURL):
(WebCore::ContentExtensions::ContentExtensionsBackend::shouldBlockURL): Deleted.
* contentextensions/ContentExtensionsBackend.h:

* contentextensions/ContentExtensionsManager.cpp:
(WebCore::ContentExtensions::ExtensionsManager::loadAction):

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):

* page/UserContentController.cpp:
(WebCore::UserContentController::actionForURL):
(WebCore::UserContentController::contentFilterBlocksURL): Deleted.
* page/UserContentController.h:

LayoutTests:

* http/tests/cookies/resources/echo-cookies.php: Added.
* http/tests/usercontentfilter/block-cookies-basic-expected.txt: Added.
* http/tests/usercontentfilter/block-cookies-basic.html: Added.
* http/tests/usercontentfilter/block-cookies-basic.html.json: Added.
* http/tests/usercontentfilter/block-cookies-send-expected.txt: Added.
* http/tests/usercontentfilter/block-cookies-send.html: Added.
* http/tests/usercontentfilter/block-cookies-send.html.json: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionRuleh">trunk/Source/WebCore/contentextensions/ContentExtensionRule.h</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionsBackendcpp">trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionsBackendh">trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h</a></li>
<li><a href="#trunkSourceWebCorecontentextensionsContentExtensionsManagercpp">trunk/Source/WebCore/contentextensions/ContentExtensionsManager.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceLoadercpp">trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCorepageUserContentControllercpp">trunk/Source/WebCore/page/UserContentController.cpp</a></li>
<li><a href="#trunkSourceWebCorepageUserContentControllerh">trunk/Source/WebCore/page/UserContentController.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestscookiesresourcesechocookiesphp">trunk/LayoutTests/http/tests/cookies/resources/echo-cookies.php</a></li>
<li><a href="#trunkLayoutTestshttptestsusercontentfilterblockcookiesbasicexpectedtxt">trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-basic-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsusercontentfilterblockcookiesbasichtml">trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-basic.html</a></li>
<li><a href="#trunkLayoutTestshttptestsusercontentfilterblockcookiesbasichtmljson">trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-basic.html.json</a></li>
<li><a href="#trunkLayoutTestshttptestsusercontentfilterblockcookiessendexpectedtxt">trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-send-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsusercontentfilterblockcookiessendhtml">trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-send.html</a></li>
<li><a href="#trunkLayoutTestshttptestsusercontentfilterblockcookiessendhtmljson">trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-send.html.json</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (180782 => 180783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-02-27 22:45:33 UTC (rev 180782)
+++ trunk/LayoutTests/ChangeLog        2015-02-27 22:50:03 UTC (rev 180783)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-02-27  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Add a &quot;block-cookies&quot; rule to the user content filter.
+        https://bugs.webkit.org/show_bug.cgi?id=142105
+
+        Reviewed by Alex Christensen.
+
+        * http/tests/cookies/resources/echo-cookies.php: Added.
+        * http/tests/usercontentfilter/block-cookies-basic-expected.txt: Added.
+        * http/tests/usercontentfilter/block-cookies-basic.html: Added.
+        * http/tests/usercontentfilter/block-cookies-basic.html.json: Added.
+        * http/tests/usercontentfilter/block-cookies-send-expected.txt: Added.
+        * http/tests/usercontentfilter/block-cookies-send.html: Added.
+        * http/tests/usercontentfilter/block-cookies-send.html.json: Added.
+
</ins><span class="cx"> 2015-02-27  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         iOS, GTK, and EFL rebaselines after r180726.
</span></span></pre></div>
<a id="trunkLayoutTestshttptestscookiesresourcesechocookiesphp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/cookies/resources/echo-cookies.php (0 => 180783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/cookies/resources/echo-cookies.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/cookies/resources/echo-cookies.php        2015-02-27 22:50:03 UTC (rev 180783)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+&lt;?php
+
+function echoCookie($value, $name)
+{
+    echo &quot;$name = $value\n&quot;;
+}
+
+echo &quot;Cookies are:\n&quot;;
+array_walk($_COOKIE, echoCookie);    
+
+?&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsusercontentfilterblockcookiesbasicexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-basic-expected.txt (0 => 180783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-basic-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-basic-expected.txt        2015-02-27 22:50:03 UTC (rev 180783)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This image resource sets a cookie. But based on the content rules, setting cookie should be blocked.
+document.cookie should be empty, and its value is ''
+
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsusercontentfilterblockcookiesbasichtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-basic.html (0 => 180783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-basic.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-basic.html        2015-02-27 22:50:03 UTC (rev 180783)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+&lt;script&gt;
+if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+}
+
+function loaded()
+{
+        document.getElementById(&quot;logger&quot;).innerHTML += &quot;document.cookie should be empty, and its value is '&quot; + document.cookie + &quot;'&quot;;
+        
+        if (window.testRunner)
+                testRunner.notifyDone();
+}
+&lt;/script&gt;
+
+This image resource sets a cookie. But based on the content rules, setting cookie should be blocked.&lt;br&gt;
+&lt;div id=&quot;logger&quot;&gt;&lt;/div&gt;&lt;br&gt;
+&lt;img src=&quot;http://127.0.0.1:8000/cookies/resources/cookie-utility.php?queryfunction=setFooCookie&quot; onerror=&quot;loaded()&quot;&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsusercontentfilterblockcookiesbasichtmljson"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-basic.html.json (0 => 180783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-basic.html.json                                (rev 0)
+++ trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-basic.html.json        2015-02-27 22:50:03 UTC (rev 180783)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+[
+    {
+        &quot;action&quot;: {
+            &quot;type&quot;: &quot;block-cookies&quot;
+        },
+        &quot;trigger&quot;: {
+            &quot;url-filter&quot;: &quot;http://127.0.0.1:8000/cookies/resources/cookie-utility.php&quot;
+        }
+    }
+]
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsusercontentfilterblockcookiessendexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-send-expected.txt (0 => 180783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-send-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-send-expected.txt        2015-02-27 22:50:03 UTC (rev 180783)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+This test loads a resource that sets a cookie, then verifies that the cookie is not sent out when it should be blocked.
+After the image, document.cookie is 'foo=awesomevalue'
+After the iframe, document.cookie is 'foo=awesomevalue'

+
+--------
+Frame: 'iframe'
+--------
+Cookies are:
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsusercontentfilterblockcookiessendhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-send.html (0 => 180783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-send.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-send.html        2015-02-27 22:50:03 UTC (rev 180783)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+&lt;script&gt;
+if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.dumpChildFramesAsText();
+        testRunner.waitUntilDone();
+}
+
+function iframeDone()
+{
+        document.getElementById(&quot;logger&quot;).innerHTML += &quot;After the iframe, document.cookie is '&quot; + document.cookie + &quot;'&lt;br&gt;&quot;;
+
+        if (window.testRunner)
+                testRunner.notifyDone();
+}
+
+function imageDone()
+{
+        document.getElementById(&quot;logger&quot;).innerHTML += &quot;After the image, document.cookie is '&quot; + document.cookie + &quot;'&lt;br&gt;&quot;;
+        document.getElementById(&quot;iframe&quot;).onload = iframeDone;
+        document.getElementById(&quot;iframe&quot;).src = &quot;http://127.0.0.1:8000/cookies/resources/echo-cookies.php&quot;;
+}
+
+
+&lt;/script&gt;
+
+This test loads a resource that sets a cookie, then verifies that the cookie is not sent out when it should be blocked.&lt;br&gt;
+&lt;div id=&quot;logger&quot;&gt;&lt;/div&gt;
+&lt;img src=&quot;http://127.0.0.1:8000/cookies/resources/cookie-utility.php?queryfunction=setFooCookie&quot; onerror=&quot;imageDone();&quot;&gt;
+&lt;iframe id=&quot;iframe&quot;&gt;&lt;/iframe&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsusercontentfilterblockcookiessendhtmljson"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-send.html.json (0 => 180783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-send.html.json                                (rev 0)
+++ trunk/LayoutTests/http/tests/usercontentfilter/block-cookies-send.html.json        2015-02-27 22:50:03 UTC (rev 180783)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+[
+    {
+        &quot;action&quot;: {
+            &quot;type&quot;: &quot;block-cookies&quot;
+        },
+        &quot;trigger&quot;: {
+            &quot;url-filter&quot;: &quot;http://127.0.0.1:8000/cookies/resources/echo-cookies&quot;
+        }
+    }
+]
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (180782 => 180783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-02-27 22:45:33 UTC (rev 180782)
+++ trunk/Source/WebCore/ChangeLog        2015-02-27 22:50:03 UTC (rev 180783)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2015-02-27  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Add a &quot;block-cookies&quot; rule to the user content filter.
+        https://bugs.webkit.org/show_bug.cgi?id=142105
+
+        Reviewed by Alex Christensen.
+
+        Tests: http/tests/usercontentfilter/block-cookies-basic.html
+               http/tests/usercontentfilter/block-cookies-send.html
+
+        * contentextensions/ContentExtensionRule.h:
+
+        * contentextensions/ContentExtensionsBackend.cpp:
+        (WebCore::ContentExtensions::ContentExtensionsBackend::actionForURL):
+        (WebCore::ContentExtensions::ContentExtensionsBackend::shouldBlockURL): Deleted.
+        * contentextensions/ContentExtensionsBackend.h:
+
+        * contentextensions/ContentExtensionsManager.cpp:
+        (WebCore::ContentExtensions::ExtensionsManager::loadAction):
+
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::requestResource):
+
+        * page/UserContentController.cpp:
+        (WebCore::UserContentController::actionForURL):
+        (WebCore::UserContentController::contentFilterBlocksURL): Deleted.
+        * page/UserContentController.h:
+
</ins><span class="cx"> 2015-02-27  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [WinCairo] Unreviewed build fix.
</span></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/contentextensions/ContentExtensionRule.h (180782 => 180783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionRule.h        2015-02-27 22:45:33 UTC (rev 180782)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionRule.h        2015-02-27 22:50:03 UTC (rev 180783)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> 
</span><span class="cx"> enum class ExtensionActionType {
</span><span class="cx">     BlockLoad,
</span><ins>+    BlockCookies,
</ins><span class="cx">     IgnorePreviousRules
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionsBackendcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp (180782 => 180783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp        2015-02-27 22:45:33 UTC (rev 180782)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp        2015-02-27 22:50:03 UTC (rev 180783)
</span><span class="lines">@@ -117,7 +117,7 @@
</span><span class="cx">     m_ruleLists.clear();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool ContentExtensionsBackend::shouldBlockURL(const URL&amp; url)
</del><ins>+ContentFilterAction ContentExtensionsBackend::actionForURL(const URL&amp; url)
</ins><span class="cx"> {
</span><span class="cx">     const String&amp; urlString = url.string();
</span><span class="cx">     ASSERT_WITH_MESSAGE(urlString.containsOnlyASCII(), &quot;A decoded URL should only contain ASCII characters. The matching algorithm assumes the input is ASCII.&quot;);
</span><span class="lines">@@ -133,12 +133,16 @@
</span><span class="cx">             copyToVector(triggeredActions, sortedActions);
</span><span class="cx">             std::sort(sortedActions.begin(), sortedActions.end());
</span><span class="cx">             size_t lastAction = static_cast&lt;size_t&gt;(sortedActions.last());
</span><del>-            if (compiledContentExtension.ruleList[lastAction].action().type == ExtensionActionType::BlockLoad)
-                return true;
</del><ins>+            ExtensionActionType type = compiledContentExtension.ruleList[lastAction].action().type;
+
+            if (type == ExtensionActionType::BlockLoad)
+                return ContentFilterAction::Block;
+            if (type == ExtensionActionType::BlockCookies)
+                return ContentFilterAction::BlockCookies;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return false;
</del><ins>+    return ContentFilterAction::Load;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace ContentExtensions
</span></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionsBackendh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h (180782 => 180783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h        2015-02-27 22:45:33 UTC (rev 180782)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h        2015-02-27 22:50:03 UTC (rev 180783)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include &quot;ContentExtensionRule.h&quot;
</span><span class="cx"> #include &quot;DFA.h&quot;
</span><span class="cx"> #include &quot;DFABytecode.h&quot;
</span><ins>+#include &quot;UserContentController.h&quot;
</ins><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringHash.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="lines">@@ -57,7 +58,7 @@
</span><span class="cx">     void removeAllRuleLists();
</span><span class="cx"> 
</span><span class="cx">     // - Internal WebCore Interface.
</span><del>-    bool shouldBlockURL(const URL&amp;);
</del><ins>+    ContentFilterAction actionForURL(const URL&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     struct CompiledContentExtension {
</span></span></pre></div>
<a id="trunkSourceWebCorecontentextensionsContentExtensionsManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/contentextensions/ContentExtensionsManager.cpp (180782 => 180783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/contentextensions/ContentExtensionsManager.cpp        2015-02-27 22:45:33 UTC (rev 180782)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsManager.cpp        2015-02-27 22:50:03 UTC (rev 180783)
</span><span class="lines">@@ -96,6 +96,8 @@
</span><span class="cx">         action.type = ExtensionActionType::BlockLoad;
</span><span class="cx">     else if (actionType == &quot;ignore-previous-rules&quot;)
</span><span class="cx">         action.type = ExtensionActionType::IgnorePreviousRules;
</span><ins>+    else if (actionType == &quot;block-cookies&quot;)
+        action.type = ExtensionActionType::BlockCookies;
</ins><span class="cx">     else if (actionType != &quot;block&quot; &amp;&amp; actionType != &quot;&quot;) {
</span><span class="cx">         WTFLogAlways(&quot;Unrecognized action: \&quot;%s\&quot;&quot;, actionType.utf8().data());
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (180782 => 180783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2015-02-27 22:45:33 UTC (rev 180782)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2015-02-27 22:50:03 UTC (rev 180783)
</span><span class="lines">@@ -464,8 +464,16 @@
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span><del>-    if (frame() &amp;&amp; frame()-&gt;page() &amp;&amp; frame()-&gt;page()-&gt;userContentController() &amp;&amp; frame()-&gt;page()-&gt;userContentController()-&gt;contentFilterBlocksURL(url))
-        return nullptr;
</del><ins>+    ContentFilterAction action = ContentFilterAction::Load;
+
+    if (frame() &amp;&amp; frame()-&gt;page() &amp;&amp; frame()-&gt;page()-&gt;userContentController()) {
+        action = frame()-&gt;page()-&gt;userContentController()-&gt;actionForURL(url);
+        if (action == ContentFilterAction::Block)
+            return nullptr;
+    }
+
+    if (action == ContentFilterAction::BlockCookies)
+        request.mutableResourceRequest().setAllowCookies(false);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     auto&amp; memoryCache = MemoryCache::singleton();
</span></span></pre></div>
<a id="trunkSourceWebCorepageUserContentControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/UserContentController.cpp (180782 => 180783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/UserContentController.cpp        2015-02-27 22:45:33 UTC (rev 180782)
+++ trunk/Source/WebCore/page/UserContentController.cpp        2015-02-27 22:50:03 UTC (rev 180783)
</span><span class="lines">@@ -203,12 +203,12 @@
</span><span class="cx">     m_contentExtensionBackend-&gt;removeAllRuleLists();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool UserContentController::contentFilterBlocksURL(const URL&amp; url)
</del><ins>+ContentFilterAction UserContentController::actionForURL(const URL&amp; url)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_contentExtensionBackend)
</span><del>-        return false;
</del><ins>+        return ContentFilterAction::Load;
</ins><span class="cx"> 
</span><del>-    return m_contentExtensionBackend-&gt;shouldBlockURL(url);
</del><ins>+    return m_contentExtensionBackend-&gt;actionForURL(url);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorepageUserContentControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/UserContentController.h (180782 => 180783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/UserContentController.h        2015-02-27 22:45:33 UTC (rev 180782)
+++ trunk/Source/WebCore/page/UserContentController.h        2015-02-27 22:50:03 UTC (rev 180783)
</span><span class="lines">@@ -49,6 +49,12 @@
</span><span class="cx"> class ContentExtensionsBackend;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+enum class ContentFilterAction {
+    Load,
+    Block,
+    BlockCookies
+};
+
</ins><span class="cx"> class UserContentController : public RefCounted&lt;UserContentController&gt; {
</span><span class="cx"> public:
</span><span class="cx">     WEBCORE_EXPORT static RefPtr&lt;UserContentController&gt; create();
</span><span class="lines">@@ -85,7 +91,7 @@
</span><span class="cx">     WEBCORE_EXPORT void removeAllUserContentFilters();
</span><span class="cx">     
</span><span class="cx">     // FIXME: Consider putting this (and other future content filter predicates) in its own class.
</span><del>-    bool contentFilterBlocksURL(const URL&amp;);
</del><ins>+    ContentFilterAction actionForURL(const URL&amp;);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre>
</div>
</div>

</body>
</html>