<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>205720</bug_id>
          
          <creation_ts>2020-01-03 05:42:47 -0800</creation_ts>
          <short_desc>WKUserContentController Block rules introspection</short_desc>
          <delta_ts>2021-05-28 07:41:57 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit2</component>
          <version>Safari 13</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Krzysztof Jan Modras [:chrmod]">krzysztof.modras</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>achristensen</cc>
    
    <cc>am</cc>
    
    <cc>krzysztof.modras</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>mjs</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1602396</commentid>
    <comment_count>0</comment_count>
    <who name="Krzysztof Jan Modras [:chrmod]">krzysztof.modras</who>
    <bug_when>2020-01-03 05:42:47 -0800</bug_when>
    <thetext>WKWebView provides no way to introspect what is blocked by the Block Rules. 
This, firstly, makes it more difficult to debug rules, as we cannot be sure if a rule matches the intended url, or if a particular rule is too aggressive and matching too many urls. 
Secondly, most browser using this feature like to include a counter to show how many requests were blocked on a specific page.
Currently, in Firefox and Cliqz, this is implemented by a UserScript that tries to collect urls from the document and re-match against a blocklist in the app (which is both inefficient and imprecise).

Introspection API would be helpful to detect the breakage introduced by blocking rules.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1602720</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-01-03 20:22:15 -0800</bug_when>
    <thetext>&lt;rdar://problem/58312877&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1620600</commentid>
    <comment_count>2</comment_count>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2020-02-19 02:41:43 -0800</bug_when>
    <thetext>To be clear, you&apos;re asking for WKWebView API for this, for the embedding app, rather than exposing this to content blocker extensions?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1620609</commentid>
    <comment_count>3</comment_count>
    <who name="Krzysztof Jan Modras [:chrmod]">krzysztof.modras</who>
    <bug_when>2020-02-19 03:08:33 -0800</bug_when>
    <thetext>Correct, our context is a privacy oriented web browser.

For example it would be useful to ask WKContentRuleListStore if the given URL will be blocked.

This is partially related to https://bugs.webkit.org/show_bug.cgi?id=152598#c9

Not sure how this would work for content blocking extensions. Perhaps Andrey Meshkov can provide some insights on it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1620617</commentid>
    <comment_count>4</comment_count>
    <who name="Andrey Meshkov">am</who>
    <bug_when>2020-02-19 03:28:22 -0800</bug_when>
    <thetext>Well, if WKContentRuleListStore would provide a &quot;checkRequest&quot; method, we could benefit from this as well. For instance, we could add a simple &quot;rule testing&quot; tool right in the app.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>