Skip to content

Refactor the widely spread usage of `window.close()`

As discussed in https://gitlab.com/eyeo/adblockplus/abpui/adblockplusui/merge_requests/144, we would like to have a more normalized and maintainable pattern to close the popup when new tabs are opened, focused, or involved.

Issue

Chrome and Firefox (Edge needs tests too) do not behave the same in terms of closing the popup when the page is refreshed or a new tab, explicitly or implicitly active, is opened.

What could we do

We should probably operate at the browser.tabs.create level, understanding if the active property is used (or absent) and close the window automatically after the operation succeed.

This would move the problem, and its normalization, into one place, instead of every possible listener use case.

Edited by Thomas Greiner
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information