Bug 175177 - ignore-previous-rules does not affect CSS rules with a generic URL filter
Summary: ignore-previous-rules does not affect CSS rules with a generic URL filter
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: Safari 10
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-03 23:46 PDT by Manish Jethani
Modified: 2017-08-03 23:46 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Manish Jethani 2017-08-03 23:46:10 PDT
Use this rule set:

  [
    {
      "trigger": {
        "url-filter": "^https?://"
      },
      "action": {
        "type": "css-display-none",
        "selector": ".sponsored-container-bottom"
      }
    },
    {
      "trigger": {
        "url-filter": "^https?://([^/]+\\.)?walmart\\.com"
      },
      "action": {
        "type": "ignore-previous-rules"
      }
    }
  ]

And go to the following page:

https://www.walmart.com/search/?query=car%20rental%20cologne

There is an element with the class "sponsored-container-bottom" that is hidden.

Since this is walmart.com, the CSS rule should be ignored and the element should not be hidden.

The current workaround is to change the rule set to the following:

 [
    {
      "trigger": {
        "url-filter": "^https?://"
        "unless-domain": ["*walmart.com"]
      },
      "action": {
        "type": "css-display-none",
        "selector": ".sponsored-container-bottom"
      }
    }
  ]

This is not ideal because it would only work if walmart.com is the top URL, not if it's an iframe.