Skip to content

Perceptual hash snippet fails

Environment

This came through while testing https://issues.adblockplus.org/ticket/7187#comment:11

Chrome or Firefox with the WebExt that has the snippet.

How to reproduce

  1. Go to https://wspee.gitlab.io/percippet/test.html
  2. Add the following snippet filter: wspee.gitlab.io#$#hide-if-contains-image-hash 0100010101010101 '#hash-selector-searchSelector-selection > div' img 740x0x60x60
  3. Open the dev tools
  4. Reload the page

Observed behavior

Exception are thrown in Chrome.

VM62:1249 Uncaught TypeError: Cannot read property 'NaN' of undefined
    at bmvbhash (eval at <anonymous> (test.html:10), <anonymous>:1249:26)
    at hashImage (eval at <anonymous> (test.html:10), <anonymous>:1269:10)
    at Image.imageElement.onload (eval at <anonymous> (test.html:10), <anonymous>:1378:22)

Firefox has other exceptions.

Expected behavior

No exception and things work.