<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:roop+webkit&#64;roopc.net" title="Roopesh Chander &lt;roop+webkit&#64;roopc.net&gt;"> <span class="fn">Roopesh Chander</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Content Extensions] Content blocking rules are not consulted for pings (&lt;a ping&gt;)"
   href="https://bugs.webkit.org/show_bug.cgi?id=149873">bug 149873</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Attachment #262754 is obsolete</td>
           <td>
               &nbsp;
           </td>
           <td>1
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Content Extensions] Content blocking rules are not consulted for pings (&lt;a ping&gt;)"
   href="https://bugs.webkit.org/show_bug.cgi?id=149873#c12">Comment # 12</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Content Extensions] Content blocking rules are not consulted for pings (&lt;a ping&gt;)"
   href="https://bugs.webkit.org/show_bug.cgi?id=149873">bug 149873</a>
              from <span class="vcard"><a class="email" href="mailto:roop+webkit&#64;roopc.net" title="Roopesh Chander &lt;roop+webkit&#64;roopc.net&gt;"> <span class="fn">Roopesh Chander</span></a>
</span></b>
        <pre>Created <span class=""><a href="attachment.cgi?id=262988&amp;action=diff" name="attach_262988" title="Patch (fails one test)">attachment 262988</a> <a href="attachment.cgi?id=262988&amp;action=edit" title="Patch (fails one test)">[details]</a></span>
Patch (fails one test)

On the code changes:

 1. I created a new function in ContentExtensionsBackend.cpp called processContentExtensionRulesForPing() for handling pings, but it turned out to have a lot in common with processContentExtensionRulesForLoad(), so I've refactored out the common parts into a private method called processContentExtensionRules().

 2. In PingLoader::sendViolationReport(), I changed the existing code that roughly translates to (pseudocode):

        request.setAllowCookies(isSameSchemeHostPort(securityOriginOfURL))

    to something like (pseudocode):

        if (!isSameSchemeHostPort(securityOriginOfURL) || isCookiesBlocked) {
            request.setAllowCookies(false)
        }

    because it appears that the default allowCookies value could be false in iOS, which the earlier version could inadvertently turn on.

 3. Hiding content (&quot;css-display-none&quot;) on an &lt;a ping&gt; is not working. I don't know why at present. I'm submitting this patch anyway so I can get an early feedback, and maybe some insight into why it might not be working.

On the tests:

 1. There are 3 types of pings (loadImage(), sendPing(), sendViolationReport()), and 3 actions (&quot;block&quot;, &quot;block-cookies&quot;, &quot;css-display-none&quot;), resulting in 9 scenarios to test. However, I can't think of a good way to test the combination of loadImage() + css-display-none (the ping is sent when the page is unloaded, so is it possible / useful to test hiding of an element in an unloaded page?), so that is excluded.

 2. The hide-on-ping.html test fails because of #3 above. So, I've not marked this for review.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>