Open g-sam opened 1 year ago
Are there any permission alerts waiting on the user to respond? If the extension does not have access to just one of the tabs that would be returned in the query, the callback/promise will wait for the user to respond to allow or deny permission not those sites open in the tabs.
The code has moved on and I'm not in a position to check this at the moment, but the fact the promise always resolved eventually without me changing any permissions makes me doubt exactly that was the issue. That said I wonder if the root of this bug could be an underlying bug to do with permissions.
I recently run up against something similar - tabs.update was not resolving, and it was permissions issue. The issue being when you grant an optional permission for a host, the update does not seem to be reflected in Safari settings. i.e. that host is now enabled, but it is still listed as "Ask". Now if a user clicks that setting and reselects "Ask" nothing has apparently changed, yet the previously granted optional permission is revoked.
Interesting.
Safari will auto respond to the promise after a 1-2 min delay if the user hasn't acted on the permission request. So that timeout could be what you were seeing with it eventually resolving. It does sound like there is a bug here in some cases.
Aha, good to know, thanks. I think you're right, it's a permissions issue...
I've been experimenting with it today. If I have open some tabs without host permission (and which do not need them) and one tab with host permissions, then call tabs.query({url: urlWithHostPermissions})
I can observe the following:
So I guess the underlying bug is that the url filter is ignored, unless I'm somehow calling it wrong.
Thanks! This should be easy to track down and fix.
This should be fixed in Safari Technology Preview 192.
In my Manifest v3 extension this query sometimes takes an unreasonably long time to complete (60 secs +). I am not sure whether specific conditions are required to trigger the bug.
Tested with Safari 16.4, macOS Ventura