Frage

I try to understand how adblock hides elements. I only see something like that -moz-binding: url("about:abp-elemhidehit?067696143543#dummy") !important;. And this binding is empty. I look in sources and see AboutHandler that intercept abp-elemhidehit?(Math.Random), But it looks like the fact that this class simply counts the number of hits in the filter. How -moz-binding can hide node?

War es hilfreich?

Lösung

The open method of the HitRegistrationChannel returns <bindings xmlns='http://www.mozilla.org/xbl'><binding id='dummy'/></bindings> on a miss and <bindings xmlns='http://www.mozilla.org/xbl'/> on a hit.

The former seems neutral and unobtrusive. But the latter has the effect of display:none.

I don't know what's the benefit of this approach, but it works.

edit: Probably untrusted code can modify css properties but not -moz-binding

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top