Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Issue 29833630: Issue 6798 - Implement hide-if-shadow-contains snippet (Closed)

Created:
July 19, 2018, 2:29 a.m. by Manish Jethani
Modified:
July 19, 2018, 4:59 p.m.
Reviewers:
kzar, hub
CC:
Sebastian Noack
Base URL:
https://hg.adblockplus.org/adblockpluscore/
Visibility:
Public.

Description

This snippet is useful for websites like yandex.ru that tuck the "реклама" label inside a closed shadow root. Try this filter: yandex.ru#$#hide-if-shadow-contains реклама li Also see #5650.

Patch Set 1 #

Total comments: 15

Patch Set 2 : Remove premature hardening #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+102 lines, -0 lines) Patch
M lib/content/snippets.js View 1 2 chunks +102 lines, -0 lines 5 comments Download

Messages

Total messages: 15
Manish Jethani
July 19, 2018, 2:29 a.m. (2018-07-19 02:29:31 UTC) #1
Manish Jethani
Patch Set 1 I'll file an issue on Trac, but meanwhile see the description here.
July 19, 2018, 2:33 a.m. (2018-07-19 02:33:08 UTC) #2
kzar
https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js#newcode111 lib/content/snippets.js:111: new MutationObserver(() => I wonder if we should just ...
July 19, 2018, 1:02 p.m. (2018-07-19 13:02:10 UTC) #3
Manish Jethani
https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js#newcode111 lib/content/snippets.js:111: new MutationObserver(() => On 2018/07/19 13:02:09, kzar wrote: > ...
July 19, 2018, 1:30 p.m. (2018-07-19 13:30:09 UTC) #4
kzar
https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js#newcode111 lib/content/snippets.js:111: new MutationObserver(() => On 2018/07/19 13:30:09, Manish Jethani wrote: ...
July 19, 2018, 1:38 p.m. (2018-07-19 13:38:11 UTC) #5
Manish Jethani
https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js#newcode171 lib/content/snippets.js:171: originalAttachShadow.apply.bind(originalAttachShadow); On 2018/07/19 13:38:11, kzar wrote: > On 2018/07/19 ...
July 19, 2018, 2:20 p.m. (2018-07-19 14:20:54 UTC) #6
kzar
https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js#newcode171 lib/content/snippets.js:171: originalAttachShadow.apply.bind(originalAttachShadow); On 2018/07/19 14:20:54, Manish Jethani wrote: > No, ...
July 19, 2018, 3:02 p.m. (2018-07-19 15:02:52 UTC) #7
Manish Jethani
https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js#newcode171 lib/content/snippets.js:171: originalAttachShadow.apply.bind(originalAttachShadow); On 2018/07/19 15:02:52, kzar wrote: > On 2018/07/19 ...
July 19, 2018, 3:28 p.m. (2018-07-19 15:28:35 UTC) #8
kzar
https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js#newcode171 lib/content/snippets.js:171: originalAttachShadow.apply.bind(originalAttachShadow); On 2018/07/19 15:28:34, Manish Jethani wrote: > OK, ...
July 19, 2018, 3:33 p.m. (2018-07-19 15:33:33 UTC) #9
Manish Jethani
https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js#newcode171 lib/content/snippets.js:171: originalAttachShadow.apply.bind(originalAttachShadow); On 2018/07/19 15:33:33, kzar wrote: > On 2018/07/19 ...
July 19, 2018, 3:39 p.m. (2018-07-19 15:39:57 UTC) #10
kzar
https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js#newcode171 lib/content/snippets.js:171: originalAttachShadow.apply.bind(originalAttachShadow); On 2018/07/19 15:39:57, Manish Jethani wrote: > I ...
July 19, 2018, 3:52 p.m. (2018-07-19 15:52:40 UTC) #11
Manish Jethani
Patch Set 2: Remove premature hardening https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/29833630/diff/29833631/lib/content/snippets.js#newcode171 lib/content/snippets.js:171: originalAttachShadow.apply.bind(originalAttachShadow); On 2018/07/19 ...
July 19, 2018, 4:04 p.m. (2018-07-19 16:04:58 UTC) #12
kzar
https://codereview.adblockplus.org/29833630/diff/29834607/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/29833630/diff/29834607/lib/content/snippets.js#newcode163 lib/content/snippets.js:163: let originalAttachShadow = Element.prototype.attachShadow; With my suggestions below we ...
July 19, 2018, 4:11 p.m. (2018-07-19 16:11:41 UTC) #13
Manish Jethani
https://codereview.adblockplus.org/29833630/diff/29834607/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/29833630/diff/29834607/lib/content/snippets.js#newcode207 lib/content/snippets.js:207: let root = originalAttachShadow.apply(this, args); On 2018/07/19 16:11:41, kzar ...
July 19, 2018, 4:15 p.m. (2018-07-19 16:15:11 UTC) #14
kzar
July 19, 2018, 4:28 p.m. (2018-07-19 16:28:51 UTC) #15
LGTM

https://codereview.adblockplus.org/29833630/diff/29834607/lib/content/snippet...
File lib/content/snippets.js (right):

https://codereview.adblockplus.org/29833630/diff/29834607/lib/content/snippet...
lib/content/snippets.js:207: let root = originalAttachShadow.apply(this, args);
On 2018/07/19 16:15:10, Manish Jethani wrote:
> On 2018/07/19 16:11:41, kzar wrote:
> > `let root = this.attachShadow(...args);`
> 
> Isn't this going to be an infinite loop? this.attachShadow would refer in turn
> to this very function, if I am not mistaken.

Oh yea, good point we're overwriting it ourselves. Fair enough.

Powered by Google App Engine
This is Rietveld