Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'log-on-stack-trace' — player is broken on deltabit.co #384

Closed
Alex-302 opened this issue Dec 5, 2023 · 1 comment
Closed

Fix 'log-on-stack-trace' — player is broken on deltabit.co #384

Alex-302 opened this issue Dec 5, 2023 · 1 comment

Comments

@Alex-302
Copy link
Member

Alex-302 commented Dec 5, 2023

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

@AdamWr
Copy link
Member

AdamWr commented Dec 5, 2023

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/')

@adguard-bot adguard-bot assigned slavaleleka and unassigned maximtop Jul 27, 2024
@slavaleleka slavaleleka added the bug Something isn't working label Aug 22, 2024
@adguard-bot adguard-bot changed the title 'log-on-stack-trace' breaks a player on deltabit.co Fix 'log-on-stack-trace' — player is broken on deltabit.co Aug 22, 2024
adguard pushed a commit that referenced this issue Aug 26, 2024
…trace` and `abort-on-stack-trace` scriptlets. #384

Squashed commit of the following:

commit 0f6b357
Merge: 1ce19f2 aefd3da
Author: Adam Wróblewski <adam@adguard.com>
Date:   Thu Aug 22 13:44:45 2024 +0200

    Merge branch 'master' into fix/AG-28397

commit 1ce19f2
Author: Adam Wróblewski <adam@adguard.com>
Date:   Thu Aug 22 13:42:45 2024 +0200

    Fix changelog
    Rename getRegexpValues to backupRegExpValues
    Rename setPreviousRegExpValues to restoreRegExpValues
    Log error
    Add test for backupRegExpValues

commit 579b9d9
Author: Adam Wróblewski <adam@adguard.com>
Date:   Thu Aug 22 11:59:59 2024 +0200

    Change null to void

commit ecb91de
Author: Adam Wróblewski <adam@adguard.com>
Date:   Thu Aug 22 10:55:31 2024 +0200

    Fix issue with modifying `RegExp.$1` value in `log-on-stack-trace` and `abort-on-stack-trace` scriptlets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants