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

Web page not closing when option is selected #3

Open
kolcs opened this issue Dec 15, 2023 · 19 comments
Open

Web page not closing when option is selected #3

kolcs opened this issue Dec 15, 2023 · 19 comments

Comments

@kolcs
Copy link

kolcs commented Dec 15, 2023

I would like to block notifications about adblockplus updates.
I made the following settings:
image

However when I open the following page:
https://new.adblockplus.org/en/update?an=adblockpluschrome&ap=chrome&apv=120.0.0.0&av=3.21.1&p=chromium&pv=120.0.0.0

the tab keeps opened. I also tested it with facebook.com.

@sdasda7777
Copy link
Owner

sdasda7777 commented Dec 15, 2023

Thanks, I think the issue might be the site is blocking scripts that don't have the same origin. Although you are able to enter the code, I cannot guarantee the browser will be able to execute it, iirc.

You might see reports about script origin violation in the developer console, I think.

@sdasda7777
Copy link
Owner

Oh, no, sorry for the mystification, the script execution probably has nothing to do with that. Are you sure that the regex matches the URL? You can copy the URL of the given page and test it in the tester on the settings page.

@kolcs
Copy link
Author

kolcs commented Dec 15, 2023

Yes, I tested, with the regex checker and it was OK.
Your first suggestion give me a hint, therefore I found a solution:
I redirect the page to an other one and close it.

window.location = 'https://to/other/site';
window.close();

@kolcs
Copy link
Author

kolcs commented Dec 15, 2023

Strange... It worked only once... Since then it only redirects me to any custom page I define but does not close the window...

@sdasda7777
Copy link
Owner

Yes, I tested, with the regex checker and it was OK.

Yeah, you're right, it matches for me as well. However, for me it seems to work as expected, the window gets closed. Would you mind telling me what your browser, browser version and extension version are? 🤔

Since then it only redirects me to any custom page I define but does not close the window...

That's actually the behaviour I would expect, yeah. I believe execution of scripts should be terminated when the page changes, to prevent malicious code stealing your cookies or whatever.

@kolcs
Copy link
Author

kolcs commented Dec 15, 2023

Google Chrome
Version 120.0.6099.109 (Official Build) (64-bit)

@sdasda7777
Copy link
Owner

And what is the version of ScheduleBlock you are using?

@kolcs
Copy link
Author

kolcs commented Dec 15, 2023

found it: 1.1.6

@sdasda7777
Copy link
Owner

Hmm, I'm not sure what the issue might be, this exact setup seems to be working on my machine. Are you using any extension that might be interfering? Could you try disabling all the other extensions? Also, could you show me the other rules you are using in case that is the issue?

@kolcs
Copy link
Author

kolcs commented Dec 15, 2023

Settings:
image

Disabled extensions:
image

@sdasda7777
Copy link
Owner

I don't find anything suspicious about the rules. I take it it doesn't work even with the other extensions disabled? Also, could you try Facebook instead of new.adblockplus.org again?

@kolcs
Copy link
Author

kolcs commented Dec 15, 2023

same...

@sdasda7777
Copy link
Owner

Anything of interest in the developer console? Unfortunately I can't do anything about this unless I can replicate it 😕

@kolcs
Copy link
Author

kolcs commented Dec 15, 2023

I understand. I will try later on another computer...

@sdasda7777
Copy link
Owner

@kolcs Hi, did you manage to replicate it on a different machine?

@sdasda7777
Copy link
Owner

@kolcs Hi, do you have any new information for me to look into? (I will eventually close this issue unless that is the case)

@kolcs
Copy link
Author

kolcs commented Jan 16, 2024

Sorry for the late answer. I tested it on different computers with my google profile. Then I even signed out and tested it with an empty profile and checked the console output:
image

It is the same regardless I am logged in to my profile or not.

@sdasda7777
Copy link
Owner

Hi, sorry for no reply. Does this happen to you every time you open the page? Does it happen regardless of how you open the page? I actually found one way to replicate this exact warning message, but it's not something I would personally stumble upon accidentally 😅

@sdasda7777
Copy link
Owner

sdasda7777 commented Mar 15, 2024

From what I gather, the gist seems to be that for security reasons Chrome (and Firefox as well) doesn't allow closing of windows by scripts, unless in specific circumstances. For whatever reason for you the circumstances are never met, but it generally affects all users, as I said above. Unfortunately this is completely out of the extension's control, and achieving this functionality would mean circumventing Chrome's security, and then again every time the given vulnerability is fixed. Currently it seems I can only recommend using one of the other actions instead of closing the window, and perhaps chiming in on this request for change: https://issues.chromium.org/issues/40744259

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

2 participants