Scriptlets icon indicating copy to clipboard operation
Scriptlets copied to clipboard

'log-on-stack-trace' breaks a player on deltabit.co

Open Alex-302 opened this issue 2 years ago • 1 comments

AdGuard for Chrome 4.2.228

Steps to reproduce

  1. Add deltabit.co#%#//scriptlet('log-on-stack-trace', 'document.createElement') to user rules
  2. Open https://deltabit.co/52tiyuhsq52y with Italian VPN

Actual behavior

The player is broken

Details

image

Reported by @ghajini

Alex-302 avatar Dec 05 '23 18:12 Alex-302

Another steps to reproduce:

  1. Add this rule:
fiddle.jshell.net#%#//scriptlet('log-on-stack-trace', 'document.createElement')
  1. Go to - https://jsfiddle.net/eacwL8gz/
Code:
(()=> {
    const re = /(\w+)\s(\w+)/;
    const str = 'div a';
    str.replace(re, '$2, $1');
    document.createElement(RegExp.$1);
    console.log(`RegExp.$1: ${RegExp.$1}`);
    alert(`RegExp.$1: ${RegExp.$1}`);
})();

Alert RegExp.$1: div should be displayed, but there is an error:

Uncaught DOMException: Failed to execute 'createElement' on 'Document': The tag name provided ('') is not a valid name.

As far as I understand, the problem is that RegExp.$1 is changed by scriptlet and it causes error.


The same issue occurs with rule like this:

fiddle.jshell.net#%#//scriptlet('abort-on-stack-trace', 'document.createElement', 'blablabla.whatever_test')

but it works fine when regexp is used:

fiddle.jshell.net#%#//scriptlet('abort-on-stack-trace', 'document.createElement', '/blablabla\.whatever_test/')

AdamWr avatar Dec 05 '23 19:12 AdamWr