The only way to allows GV to add or remove a permission, which would expire when the session ends, to Gecko's permission manager is following the GV's permission model, which is to ask embedding app for an approval when the requesting behaviors happen (ex. geo, camera).
Per yesterday discussion, we would like to add a
prompt, which won't really promt user, it's just a mechanism to ask embedding app for a permission, as a trigger point in order to make GV add a permission property to Gecko's permission manager, so that we can directly require permission manager to know if the site has permission or not.
However, there are still some problems if we only promt at the first attempt per origin.
(1) The result of autoplay permission are not just
From , we can see that GV would only add value either
deny to permission manager, but when asking embedding app if the site is in the blacklist or whitelist, except it's in one of those lists, the answer might also be not in any list at all. If the site is not in any list, then we should not insert value to permission manager. (keep its value
That requires a change of the
PermissionDelegate.Callback interface, because the interface only has
reject(), and they are not enough to tell us if the site is not allowed to autoplay (in the black list) or the site is not in any list at all.
In addition, autoplay permission also has another special value
BLOCKED_ALL . For above issues, it seems that we should extend the original callback interface or have a special interface for autoplay, in order to handle "in the black list v.s. not in any list" and a special value "BLOCKED_ALL"?
(2) How to synchronize the user-custom permission list from Fenix?
If we only prompt at the first attemp, and the permission, which GV inserts to permission manager, is session-based. That means if user modify the black/white list later, we couldn't know Fenix has changed the list in this session, unless user restarts Fenix.
For example, Fenix adds Youtube into its black list, so when we first prompt to Fenix, GV would add Youtube to Gecko's black list, and then we would check that value directly, instead of prompting again. If user changes their mind, removing Youtube from black list, and add it to the white list, Gecko is not able to know that, which results in using wrong permission result in the remaining session.
As we don't have any API directly update permission from GV, so even if Fenix update its list, Gecko doesn't know the permission for some sites has been changed, unless we would like to introduce new API to notify Gecko that we should try to prompt to GV again, in order to get the latest infomation.
I think if we would really want to have a list for managing specifc permission, we should have another method to directly control permission in Gecko, not relying the present mechanism all the time. Because having a list means that, we have already decide how to handle these sites for certain permission, so we could update all of them to Gecko whenever we starts GV. It's like an initialization and those permissions could still be expired when the session ends.
(3) How to notify embedding app that blocking autoplay has occurred?
As I said before, the final blocking decision is made in Gecko. Even if the embedding app denies to start autoplay (maybe the site is in the black list), the site could still be allowed to autoplay if the site has been activated by user gesture.
That means we couldn't use current mechanism to know if the site is finally blocked or not, we have to have new API to notify embedding app that blocking occurs, like what we do for desktop, dispatching an event .