Bug 162057

Summary: Content Blocker 'css-display-none' rules aren't applied when you open a website first time (from the address bar)
Product: WebKit Reporter: Andrey Meshkov <am>
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Major CC: achristensen, gsnedders, krzysztof.modras, mjs, rx100
Priority: P2    
Version: Other   
Hardware: Mac   
OS: Other   

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.
Comment 6 Sam Sneddon [:gsnedders] 2021-05-19 16:41:41 PDT

*** This bug has been marked as a duplicate of bug 170707 ***