Bug 162057 - Content Blocker 'css-display-none' rules aren't applied when you open a website first time (from the address bar)
Summary: Content Blocker 'css-display-none' rules aren't applied when you open a websi...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: Other
Hardware: Macintosh Other
: P2 Major
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-16 03:45 PDT by Andrey Meshkov
Modified: 2020-02-19 02:39 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Meshkov 2016-09-16 03:45:12 PDT
#### My configuration:
Safari Version 10.0 (12602.1.50.0.10)
macOS Sierra 10.12 (16A323)

#### Steps to reproduce

1. Register a simple content blocker:
```
[{ "trigger": { "url-filter": ".*" }, "action": { "type": "css-display-none", "selector": "body" } }]
```

2. Open a new tab
3. Enter "google.com" (or any other website) and press Enter

#### Expected result
Page is empty

#### Actual result
Page is not empty. The rule will be applied after you refresh the page.


Relevant bug reports:
https://github.com/AdguardTeam/AdguardBrowserExtension/issues/153
https://github.com/AdguardTeam/AdguardBrowserExtension/issues/359

Also there was a similar issue with searching from the address bar:
https://bugs.webkit.org/show_bug.cgi?id=153743
Comment 1 Alex Christensen 2016-10-04 15:15:22 PDT
rdar://27788755
Comment 2 Andrey Meshkov 2016-11-08 10:00:19 PST
Hi Alex!

Is there any update on this issue?
Is there anything I can do/provide that might help you?
Comment 3 rx100 2016-11-15 04:01:43 PST
I have the same problem = (
Comment 4 Andrey Meshkov 2016-11-26 07:12:44 PST
After all it appears that the bug is not that serious.

It exists only in case if "trigger" contains "resource-type" field:
```
[
    {
        "trigger": {
            "url-filter": ".*",
            "resource-type": ["document"]
        },
        "action": {
            "type": "css-display-none",
            "selector": "any selector"
        }
    }
]
```

Removing "resource-type" fixes the issue. This is still a bit weird, though.
Comment 5 Maciej Stachowiak 2020-02-19 02:39:44 PST
This is indeed pretty weird.