Bug 175177

Summary: ignore-previous-rules does not affect CSS rules with a generic URL filter
Product: WebKit Reporter: Manish Jethani <manish>
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal    
Priority: P2    
Version: Safari 10   
Hardware: Unspecified   
OS: Unspecified   

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.