Greasemonkey: Add support for @grant window.close (Tampermonkey parity)

Created on 5 Aug 2017  ·  3Comments  ·  Source: greasemonkey/greasemonkey

Hi,

I'm developing adblocking script for cases not handled by Adblock Plus filters list https://greasyfork.org/en/scripts/19993-ru-adlist-js-fixes and encountered a situation when it have to close a tab when it attempts to unload content to prevent background redirect in it (look for preventPopunders and preventPopMix functions). Some ad scripts open current page in a new tab and then load ads in the previous one to avoid popup blocking in ABP.

However, it looks like no matter where I call for window.close() it simply doesn't work in Firefox since window in which redirect happens wasn't opened by a script in the first place. In Tampermonkey I solved this with @grant window.close, but it doesn't work in Greasemonkey for Firefox.

Most helpful comment

Any progress here?

All 3 comments

See also about:config:
dom.allow_scripts_to_close_windows

Thanks, I know about this, but I can't recommend this to users. It's disabled for a reason.

Any progress here?

Was this page helpful?
0 / 5 - 0 ratings