Project 'eyeo/adblockplus/abpui/adblockplusui' was moved to 'adblockinc/ext/adblockplus/adblockplus'. Please update any links and bookmarks that may still have the old path.
Unable to close filter suggestion window in Block Element
While this is not a regression when compared to ABP 3.8, I'd rather get it fixed sooner than later, especially if it turns out it's an easy fix, so I added 2019-3.1 milestone to it.
I was able to trace this error back to browser.tabs.remove() which throws the following error:
Uncaught (in promise) Error: Tabs cannot be edited right now (user may be dragging a tab). (anonymous) @ polyfill.js:131 value @ polyfill.js:121 (anonymous) @ composer.js:64 Promise.then (async) closeMe @ composer.js:64 closeDialog @ composer.js:79
Therefore it looks like Opera, unlike other browsers, doesn't allow us to close tabs in standalone windows. There are a couple of ways how we could resolve this by calling browser.windows.remove() instead of browser.tabs.remove():
adblockpluschrome: Extend "app.get:senderId" message to also return window ID.
adblockpluschrome: Provide new message that allows UI to close itself.
adblockpluschrome: Handle error in polyfill.
adblockplusui: Make additional browser API call to determine window ID using tab ID from "app.get:senderId".
@snoack As outlined above, this could be fixed in adblockpluschrome which I'd consider to make the most sense as it's a platform-specific extension API problem. Otherwise, we could add the described workaround in adblockplusui, if you prefer that.
Makes sense. Feel free to file an issue in adblockpluschrome. FWIW, this doesn't seem to be a new regression, hence it's not critical for the upcoming release, right?
Let's wait for the discussion to conclude before we do anything here. I'm fine with reopening it and keeping it open until we're confident that no changes to adblockplusui will be necessary.
@ursakacar Thanks for bringing this up again. I agree that it makes sense to fix it together with the release of #638 (closed) so I'll assign it to release-2019-4, as suggested.
Fortunately, based on this comment, we should be able to replace the existing workaround with window.close(), which sounds reasonable to do in adblockplusui.
@ThomasGreiner from what I understood, we don't have to first implement the workaround, and then later replace it with window.close(), but we could go ahead and use window.close() in 2019-4 already right?
@ursakacar We're talking about two workarounds here:
A: The existing workaround for Firefox <52 is to use browser.tabs.remove() instead of window.close().
B: The new workaround for older Opera versions is to use window.close() instead of browser.tabs.remove().
Therefore what I'm saying is that we could remove (A), since we're going to drop support for Firefox 51, and instead use window.close(), which is expected to work across all versions of Firefox and Opera.
That being said, we should verify the assumption that window.close() works in Firefox 52-57, since this comment suggests otherwise.
No, that's part of our mocks for the test environment. The code we'd need to replace is located in adblockplusui/composer.js.
Would such change affect anything else than closing the filter composer window (trying to think of the testing scope)?
No, this change is not expected to affect anything other than the filter composer dialog window. Only if we were to fix it in adblockpluschrome, we'd end up affecting other parts of the extension.
That being said, we should verify the assumption that window.close() works in Firefox 52-57, since this comment suggests otherwise.
I run some tests and it does work on Firefox 52-57. Unfortunately, after testing the next versions I found out that it doesn't work on versions 63, 63.0.1 and 63.0.3 (Linux & Windows): neither "Cancel" nor "Block" will close the popup window if we use windows.close(). As a curious note, only 63.x has the issue; 64-70 (stopped tests there) works as well.
So, should I go then with the suggested solution where the error is catched and close the windows only then?