<!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>[182489] trunk/Source/WebCore</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/182489">182489</a></dd>
<dt>Author</dt> <dd>aestes@apple.com</dd>
<dt>Date</dt> <dd>2015-04-07 13:48:33 -0700 (Tue, 07 Apr 2015)</dd>
</dl>

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

Reviewed by Daniel Bates.

Added a new ContentFiltering logging channel, and started logging some useful diagnostic messages.

* loader/ContentFilter.cpp:
(WebCore::ContentFilter::~ContentFilter):
(WebCore::ContentFilter::willSendRequest):
(WebCore::ContentFilter::startFilteringMainResource):
(WebCore::ContentFilter::responseReceived):
(WebCore::ContentFilter::dataReceived):
(WebCore::ContentFilter::notifyFinished):
(WebCore::ContentFilter::didDecide):
* platform/Logging.h:
* platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
(WebCore::ContentFilterUnblockHandler::canHandleRequest):
(WebCore::ContentFilterUnblockHandler::requestUnblockAsync):
* platform/cocoa/NetworkExtensionContentFilter.mm:
(WebCore::NetworkExtensionContentFilter::enabled):
(WebCore::NetworkExtensionContentFilter::unblockHandler):
(WebCore::NetworkExtensionContentFilter::handleDecision):
* platform/cocoa/ParentalControlsContentFilter.mm:
(WebCore::ParentalControlsContentFilter::enabled):
(WebCore::ParentalControlsContentFilter::updateFilterState):
* testing/MockContentFilter.cpp:
(WebCore::MockContentFilter::enabled):
(WebCore::MockContentFilter::unblockHandler):
(WebCore::MockContentFilter::maybeDetermineStatus):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloaderContentFiltercpp">trunk/Source/WebCore/loader/ContentFilter.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformLoggingh">trunk/Source/WebCore/platform/Logging.h</a></li>
<li><a href="#trunkSourceWebCoreplatformcocoaContentFilterUnblockHandlerCocoamm">trunk/Source/WebCore/platform/cocoa/ContentFilterUnblockHandlerCocoa.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformcocoaNetworkExtensionContentFiltermm">trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformcocoaParentalControlsContentFiltermm">trunk/Source/WebCore/platform/cocoa/ParentalControlsContentFilter.mm</a></li>
<li><a href="#trunkSourceWebCoretestingMockContentFiltercpp">trunk/Source/WebCore/testing/MockContentFilter.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (182488 => 182489)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-04-07 20:45:49 UTC (rev 182488)
+++ trunk/Source/WebCore/ChangeLog        2015-04-07 20:48:33 UTC (rev 182489)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2015-04-07  Andy Estes  &lt;aestes@apple.com&gt;
+
+        [Content Filtering] Add logging
+        https://bugs.webkit.org/show_bug.cgi?id=143470
+
+        Reviewed by Daniel Bates.
+
+        Added a new ContentFiltering logging channel, and started logging some useful diagnostic messages.
+
+        * loader/ContentFilter.cpp:
+        (WebCore::ContentFilter::~ContentFilter):
+        (WebCore::ContentFilter::willSendRequest):
+        (WebCore::ContentFilter::startFilteringMainResource):
+        (WebCore::ContentFilter::responseReceived):
+        (WebCore::ContentFilter::dataReceived):
+        (WebCore::ContentFilter::notifyFinished):
+        (WebCore::ContentFilter::didDecide):
+        * platform/Logging.h:
+        * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
+        (WebCore::ContentFilterUnblockHandler::canHandleRequest):
+        (WebCore::ContentFilterUnblockHandler::requestUnblockAsync):
+        * platform/cocoa/NetworkExtensionContentFilter.mm:
+        (WebCore::NetworkExtensionContentFilter::enabled):
+        (WebCore::NetworkExtensionContentFilter::unblockHandler):
+        (WebCore::NetworkExtensionContentFilter::handleDecision):
+        * platform/cocoa/ParentalControlsContentFilter.mm:
+        (WebCore::ParentalControlsContentFilter::enabled):
+        (WebCore::ParentalControlsContentFilter::updateFilterState):
+        * testing/MockContentFilter.cpp:
+        (WebCore::MockContentFilter::enabled):
+        (WebCore::MockContentFilter::unblockHandler):
+        (WebCore::MockContentFilter::maybeDetermineStatus):
+
</ins><span class="cx"> 2015-04-07  Eric Carlson  &lt;eric.carlson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Mac] video playing to external device should not be interrupted
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderContentFiltercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ContentFilter.cpp (182488 => 182489)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ContentFilter.cpp        2015-04-07 20:45:49 UTC (rev 182488)
+++ trunk/Source/WebCore/loader/ContentFilter.cpp        2015-04-07 20:48:33 UTC (rev 182489)
</span><span class="lines">@@ -30,12 +30,17 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CachedRawResource.h&quot;
</span><span class="cx"> #include &quot;ContentFilterUnblockHandler.h&quot;
</span><ins>+#include &quot;Logging.h&quot;
</ins><span class="cx"> #include &quot;NetworkExtensionContentFilter.h&quot;
</span><span class="cx"> #include &quot;ParentalControlsContentFilter.h&quot;
</span><span class="cx"> #include &quot;SharedBuffer.h&quot;
</span><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><ins>+#if !LOG_DISABLED
+#include &lt;wtf/text/CString.h&gt;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> Vector&lt;ContentFilter::Type&gt;&amp; ContentFilter::types()
</span><span class="lines">@@ -73,11 +78,13 @@
</span><span class="cx">     : m_contentFilters { WTF::move(contentFilters) }
</span><span class="cx">     , m_decisionFunction { WTF::move(decisionFunction) }
</span><span class="cx"> {
</span><ins>+    LOG(ContentFiltering, &quot;Creating ContentFilter with %zu platform content filter(s).\n&quot;, m_contentFilters.size());
</ins><span class="cx">     ASSERT(!m_contentFilters.isEmpty());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ContentFilter::~ContentFilter()
</span><span class="cx"> {
</span><ins>+    LOG(ContentFiltering, &quot;Destroying ContentFilter.\n&quot;);
</ins><span class="cx">     if (!m_mainResource)
</span><span class="cx">         return;
</span><span class="cx">     ASSERT(m_mainResource-&gt;hasClient(this));
</span><span class="lines">@@ -86,6 +93,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ContentFilter::willSendRequest(ResourceRequest&amp; request, const ResourceResponse&amp; redirectResponse)
</span><span class="cx"> {
</span><ins>+    LOG(ContentFiltering, &quot;ContentFilter received request for &lt;%s&gt; with redirect response from &lt;%s&gt;.\n&quot;, request.url().string().ascii().data(), redirectResponse.url().string().ascii().data());
</ins><span class="cx">     ResourceRequest requestCopy { request };
</span><span class="cx">     ASSERT(m_state == State::Initialized || m_state == State::Filtering);
</span><span class="cx">     forEachContentFilterUntilBlocked([&amp;requestCopy, &amp;redirectResponse](PlatformContentFilter&amp; contentFilter) {
</span><span class="lines">@@ -93,11 +101,16 @@
</span><span class="cx">         if (contentFilter.didBlockData())
</span><span class="cx">             requestCopy = ResourceRequest();
</span><span class="cx">     });
</span><ins>+#if !LOG_DISABLED
+    if (request != requestCopy)
+        LOG(ContentFiltering, &quot;ContentFilter changed request url to &lt;%s&gt;.\n&quot;, requestCopy.url().string().ascii().data());
+#endif
</ins><span class="cx">     request = requestCopy;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ContentFilter::startFilteringMainResource(CachedRawResource&amp; resource)
</span><span class="cx"> {
</span><ins>+    LOG(ContentFiltering, &quot;ContentFilter will start filtering main resource at &lt;%s&gt;.\n&quot;, resource.url().string().ascii().data());
</ins><span class="cx">     ASSERT(m_state == State::Initialized);
</span><span class="cx">     m_state = State::Filtering;
</span><span class="cx">     ASSERT(!m_mainResource);
</span><span class="lines">@@ -132,6 +145,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ContentFilter::responseReceived(CachedResource* resource, const ResourceResponse&amp; response)
</span><span class="cx"> {
</span><ins>+    LOG(ContentFiltering, &quot;ContentFilter received response from &lt;%s&gt;.\n&quot;, response.url().string().ascii().data());
</ins><span class="cx">     ASSERT(m_state == State::Filtering);
</span><span class="cx">     ASSERT_UNUSED(resource, resource == m_mainResource.get());
</span><span class="cx">     forEachContentFilterUntilBlocked([&amp;response](PlatformContentFilter&amp; contentFilter) {
</span><span class="lines">@@ -141,6 +155,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ContentFilter::dataReceived(CachedResource* resource, const char* data, int length)
</span><span class="cx"> {
</span><ins>+    LOG(ContentFiltering, &quot;ContentFilter received %d bytes of data from &lt;%s&gt;.\n&quot;, length, resource-&gt;url().string().ascii().data());
</ins><span class="cx">     ASSERT(m_state == State::Filtering);
</span><span class="cx">     ASSERT_UNUSED(resource, resource == m_mainResource.get());
</span><span class="cx">     forEachContentFilterUntilBlocked([data, length](PlatformContentFilter&amp; contentFilter) {
</span><span class="lines">@@ -157,6 +172,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ContentFilter::notifyFinished(CachedResource* resource)
</span><span class="cx"> {
</span><ins>+    LOG(ContentFiltering, &quot;ContentFilter will finish filtering main resource at &lt;%s&gt;.\n&quot;, resource-&gt;url().string().ascii().data());
</ins><span class="cx">     ASSERT(m_state == State::Filtering);
</span><span class="cx">     ASSERT_UNUSED(resource, resource == m_mainResource.get());
</span><span class="cx">     forEachContentFilterUntilBlocked([](PlatformContentFilter&amp; contentFilter) {
</span><span class="lines">@@ -193,6 +209,7 @@
</span><span class="cx">     ASSERT(m_state != State::Allowed);
</span><span class="cx">     ASSERT(m_state != State::Blocked);
</span><span class="cx">     ASSERT(state == State::Allowed || state == State::Blocked);
</span><ins>+    LOG(ContentFiltering, &quot;ContentFilter decided load should be %s for main resource at &lt;%s&gt;.\n&quot;, state == State::Allowed ? &quot;allowed&quot; : &quot;blocked&quot;, m_mainResource ? m_mainResource-&gt;url().string().ascii().data() : &quot;&quot;);
</ins><span class="cx">     m_state = state;
</span><span class="cx"> 
</span><span class="cx">     // Calling m_decisionFunction might delete |this|.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformLoggingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/Logging.h (182488 => 182489)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/Logging.h        2015-04-07 20:45:49 UTC (rev 182488)
+++ trunk/Source/WebCore/platform/Logging.h        2015-04-07 20:48:33 UTC (rev 182489)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx">     M(Archives) \
</span><span class="cx">     M(BackForward) \
</span><span class="cx">     M(Compositing) \
</span><ins>+    M(ContentFiltering) \
</ins><span class="cx">     M(DOMTimers) \
</span><span class="cx">     M(Editing) \
</span><span class="cx">     M(Events) \
</span><span class="lines">@@ -67,13 +68,13 @@
</span><span class="cx">     M(RemoteInspector) \
</span><span class="cx">     M(ResourceLoading) \
</span><span class="cx">     M(SQLDatabase) \
</span><ins>+    M(Services) \
</ins><span class="cx">     M(SpellingAndGrammar) \
</span><span class="cx">     M(StorageAPI) \
</span><span class="cx">     M(Threading) \
</span><span class="cx">     M(WebAudio) \
</span><span class="cx">     M(WebGL) \
</span><span class="cx">     M(WebReplay) \
</span><del>-    M(Services) \
</del><span class="cx"> 
</span><span class="cx"> #define DECLARE_LOG_CHANNEL(name) \
</span><span class="cx">     WEBCORE_EXPORT extern WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaContentFilterUnblockHandlerCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cocoa/ContentFilterUnblockHandlerCocoa.mm (182488 => 182489)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/ContentFilterUnblockHandlerCocoa.mm        2015-04-07 20:45:49 UTC (rev 182488)
+++ trunk/Source/WebCore/platform/cocoa/ContentFilterUnblockHandlerCocoa.mm        2015-04-07 20:48:33 UTC (rev 182489)
</span><span class="lines">@@ -30,8 +30,13 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;BlockExceptions.h&quot;
</span><span class="cx"> #import &quot;ContentFilter.h&quot;
</span><ins>+#import &quot;Logging.h&quot;
</ins><span class="cx"> #import &quot;ResourceRequest.h&quot;
</span><span class="cx"> 
</span><ins>+#if !LOG_DISABLED
+#import &lt;wtf/text/CString.h&gt;
+#endif
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> #import &quot;SoftLinking.h&quot;
</span><span class="cx"> #import &quot;WebCoreThreadRun.h&quot;
</span><span class="lines">@@ -52,6 +57,7 @@
</span><span class="cx">     : m_unblockURLHost { WTF::move(unblockURLHost) }
</span><span class="cx">     , m_unblockRequester { WTF::move(unblockRequester) }
</span><span class="cx"> {
</span><ins>+    LOG(ContentFiltering, &quot;Creating ContentFilterUnblockHandler with an unblock requester and unblock URL host &lt;%s&gt;.\n&quot;, unblockURLHost.ascii().data());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="lines">@@ -59,6 +65,7 @@
</span><span class="cx">     : m_unblockURLHost { WTF::move(unblockURLHost) }
</span><span class="cx">     , m_webFilterEvaluator { WTF::move(evaluator) }
</span><span class="cx"> {
</span><ins>+    LOG(ContentFiltering, &quot;Creating ContentFilterUnblockHandler with a WebFilterEvaluator and unblock URL host &lt;%s&gt;.\n&quot;, unblockURLHost.ascii().data());
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -123,7 +130,12 @@
</span><span class="cx"> #endif
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return request.url().protocolIs(ContentFilter::urlScheme()) &amp;&amp; equalIgnoringCase(request.url().host(), m_unblockURLHost);
</del><ins>+    bool isUnblockRequest = request.url().protocolIs(ContentFilter::urlScheme()) &amp;&amp; equalIgnoringCase(request.url().host(), m_unblockURLHost);
+#if !LOG_DISABLED
+    if (isUnblockRequest)
+        LOG(ContentFiltering, &quot;ContentFilterUnblockHandler will handle &lt;%s&gt; as an unblock request.\n&quot;, request.url().string().ascii().data());
+#endif
+    return isUnblockRequest;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static inline void dispatchToMainThread(void (^block)())
</span><span class="lines">@@ -143,6 +155,7 @@
</span><span class="cx">     if (m_webFilterEvaluator) {
</span><span class="cx">         [m_webFilterEvaluator unblockWithCompletion:[decisionHandler](BOOL unblocked, NSError *) {
</span><span class="cx">             dispatchToMainThread([decisionHandler, unblocked] {
</span><ins>+                LOG(ContentFiltering, &quot;WebFilterEvaluator %s the unblock request.\n&quot;, unblocked ? &quot;allowed&quot; : &quot;did not allow&quot;);
</ins><span class="cx">                 decisionHandler(unblocked);
</span><span class="cx">             });
</span><span class="cx">         }];
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaNetworkExtensionContentFiltermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm (182488 => 182489)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm        2015-04-07 20:45:49 UTC (rev 182488)
+++ trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm        2015-04-07 20:48:33 UTC (rev 182489)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if HAVE(NETWORK_EXTENSION)
</span><span class="cx"> 
</span><span class="cx"> #import &quot;ContentFilterUnblockHandler.h&quot;
</span><ins>+#import &quot;Logging.h&quot;
</ins><span class="cx"> #import &quot;NEFilterSourceSPI.h&quot;
</span><span class="cx"> #import &quot;ResourceRequest.h&quot;
</span><span class="cx"> #import &quot;ResourceResponse.h&quot;
</span><span class="lines">@@ -53,7 +54,9 @@
</span><span class="cx"> 
</span><span class="cx"> bool NetworkExtensionContentFilter::enabled()
</span><span class="cx"> {
</span><del>-    return [getNEFilterSourceClass() filterRequired];
</del><ins>+    bool enabled = [getNEFilterSourceClass() filterRequired];
+    LOG(ContentFiltering, &quot;NetworkExtensionContentFilter is %s.\n&quot;, enabled ? &quot;enabled&quot; : &quot;not enabled&quot;);
+    return enabled;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;NetworkExtensionContentFilter&gt; NetworkExtensionContentFilter::create()
</span><span class="lines">@@ -188,6 +191,7 @@
</span><span class="cx">     return ContentFilterUnblockHandler {
</span><span class="cx">         ASCIILiteral(&quot;nefilter-unblock&quot;), [neFilterSource](DecisionHandlerFunction decisionHandler) {
</span><span class="cx">             [neFilterSource remediateWithDecisionHandler:[decisionHandler](NEFilterSourceStatus status, NSDictionary *) {
</span><ins>+                LOG(ContentFiltering, &quot;NEFilterSource %s the unblock request.\n&quot;, status == NEFilterSourceStatusPass ? &quot;allowed&quot; : &quot;did not allow&quot;);
</ins><span class="cx">                 decisionHandler(status == NEFilterSourceStatusPass);
</span><span class="cx">             }];
</span><span class="cx">         }
</span><span class="lines">@@ -202,6 +206,10 @@
</span><span class="cx">     m_status = status;
</span><span class="cx">     if (status == NEFilterSourceStatusBlock)
</span><span class="cx">         m_replacementData = replacementData;
</span><ins>+#if !LOG_DISABLED
+    if (!needsMoreData())
+        LOG(ContentFiltering, &quot;NetworkExtensionContentFilter stopped buffering with status %zd and replacement data length %zu.\n&quot;, status, replacementData.length);
+#endif
</ins><span class="cx">     dispatch_semaphore_signal(m_semaphore.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaParentalControlsContentFiltermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cocoa/ParentalControlsContentFilter.mm (182488 => 182489)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/ParentalControlsContentFilter.mm        2015-04-07 20:45:49 UTC (rev 182488)
+++ trunk/Source/WebCore/platform/cocoa/ParentalControlsContentFilter.mm        2015-04-07 20:48:33 UTC (rev 182489)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #import &quot;ParentalControlsContentFilter.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #import &quot;ContentFilterUnblockHandler.h&quot;
</span><ins>+#import &quot;Logging.h&quot;
</ins><span class="cx"> #import &quot;ResourceResponse.h&quot;
</span><span class="cx"> #import &quot;SharedBuffer.h&quot;
</span><span class="cx"> #import &quot;SoftLinking.h&quot;
</span><span class="lines">@@ -40,7 +41,9 @@
</span><span class="cx"> 
</span><span class="cx"> bool ParentalControlsContentFilter::enabled()
</span><span class="cx"> {
</span><del>-    return [getWebFilterEvaluatorClass() isManagedSession];
</del><ins>+    bool enabled = [getWebFilterEvaluatorClass() isManagedSession];
+    LOG(ContentFiltering, &quot;ParentalControlsContentFilter is %s.\n&quot;, enabled ? &quot;enabled&quot; : &quot;not enabled&quot;);
+    return enabled;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;ParentalControlsContentFilter&gt; ParentalControlsContentFilter::create()
</span><span class="lines">@@ -119,6 +122,10 @@
</span><span class="cx"> void ParentalControlsContentFilter::updateFilterState()
</span><span class="cx"> {
</span><span class="cx">     m_filterState = [m_webFilterEvaluator filterState];
</span><ins>+#if !LOG_DISABLED
+    if (!needsMoreData())
+        LOG(ContentFiltering, &quot;ParentalControlsContentFilter stopped buffering with state %d and replacement data length %zu.\n&quot;, m_filterState, [m_replacementData length]);
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoretestingMockContentFiltercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/MockContentFilter.cpp (182488 => 182489)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockContentFilter.cpp        2015-04-07 20:45:49 UTC (rev 182488)
+++ trunk/Source/WebCore/testing/MockContentFilter.cpp        2015-04-07 20:48:33 UTC (rev 182489)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ContentFilter.h&quot;
</span><span class="cx"> #include &quot;ContentFilterUnblockHandler.h&quot;
</span><ins>+#include &quot;Logging.h&quot;
</ins><span class="cx"> #include &quot;ResourceRequest.h&quot;
</span><span class="cx"> #include &quot;ResourceResponse.h&quot;
</span><span class="cx"> #include &quot;SharedBuffer.h&quot;
</span><span class="lines">@@ -57,7 +58,9 @@
</span><span class="cx"> 
</span><span class="cx"> bool MockContentFilter::enabled()
</span><span class="cx"> {
</span><del>-    return settings().enabled();
</del><ins>+    bool enabled = settings().enabled();
+    LOG(ContentFiltering, &quot;MockContentFilter is %s.\n&quot;, enabled ? &quot;enabled&quot; : &quot;not enabled&quot;);
+    return enabled;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;MockContentFilter&gt; MockContentFilter::create()
</span><span class="lines">@@ -114,6 +117,7 @@
</span><span class="cx">             bool shouldAllow { settings().unblockRequestDecision() == Decision::Allow };
</span><span class="cx">             if (shouldAllow)
</span><span class="cx">                 settings().setDecision(Decision::Allow);
</span><ins>+            LOG(ContentFiltering, &quot;MockContentFilter %s the unblock request.\n&quot;, shouldAllow ? &quot;allowed&quot; : &quot;did not allow&quot;);
</ins><span class="cx">             decisionHandler(shouldAllow);
</span><span class="cx">         }
</span><span class="cx">     };
</span><span class="lines">@@ -129,6 +133,8 @@
</span><span class="cx">     if (m_status != Status::NeedsMoreData || decisionPoint != settings().decisionPoint())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    LOG(ContentFiltering, &quot;MockContentFilter stopped buffering with status %u at decision point %u.\n&quot;, m_status, decisionPoint);
+
</ins><span class="cx">     m_status = settings().decision() == Decision::Allow ? Status::Allowed : Status::Blocked;
</span><span class="cx">     if (m_status != Status::Blocked)
</span><span class="cx">         return;
</span></span></pre>
</div>
</div>

</body>
</html>