Closed Bug 1778959 Opened 2 years ago Closed 2 years ago

Prototype an AOM SitePermsAddonProvider to support synthetic Site Permissions addon type install flows

Categories

(Toolkit :: Add-ons Manager, task, P3)

task

Tracking

()

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: rpl, Assigned: nchevobbe)

References

(Blocks 2 open bugs)

Details

(Keywords: dev-doc-needed, Whiteboard: [addons-jira])

Attachments

(7 files)

This bug goal is to prototype a new AOM provider to support a synthetic Site Permission addon type, which should:

  • derive the list of synthetic SitePermsAddon instances from the list of site origins with any addon gated permission granted;
  • provide a synthetic install flow (which should provide the same kind of install flow that the previous signed xpi version of the "sitepermission" addon type was providing) triggered when a gated addon permission is being requested.

The goal of the prototype is to help confirming that an AOM provider would be a viable, clean and simple enough approach, and if that is confirmed and if we will agree to proceed with that approach to then help informing and guiding the actual implementation work.

This patch includes a basic (but still working) version of a new SitePermsAddonProvider.

NOTE:

  • In this basic version of the provider, the list of synthetic addons is recomputed from
    the list of the granted permission on each call to getAddonByID / getAddonsByType
    that matches the parameters expected by the provider.
  • These two provider methods (getAddonBYID / getAddonsByTypes) are in practice only called
    when the user navigates to about:addons, but it may be reasonable to iterate on this
    initial prototype by introducing a cache file where we can list all origins with a gated
    addon permission and keep that cache file updated through an "perm-changed" notification
    observer and a new scan of all permission on each provider startup.

This patch includes:

  • a new AddonManager method to trigger a new SitePermsAddon install flow
  • a few more changes to the SitePermsAddonProvider to support the synthetic addon install flow

Depends on D151476

This patch includes a new PermissionUI.SitePermsAddonInstallRequestPrototype helper, it inherits from PermissionPromptForRequestPrototype
and override the prompt method to trigger the synthetic SitePermsAddon install flow when a addon gated site permissions is requested
(currently only "midi/midi-sysex").

The new SitePermsAddonInstallRequestPrototype helper is then set as the proto for the MIDIPermissionPrompt.prototype, which
makes sure that every time the MIDI site permissions are being requested, the user is prompted to install a synthetic addon
as part of the site permission request.

NOTE:

  • the rest of the MIDIPermissionPrompt is currently unused in this version of this exploratory patch, a finalized version
    of the patch should also consider if there is any scenario that would require the regular permission prompt for the
    gated site permission requests

Depends on D151477

Summary: Protoype an AOM SitePermsAddonProvider to support synthetic Site Permissions addon type install flows → Prototype an AOM SitePermsAddonProvider to support synthetic Site Permissions addon type install flows
Severity: -- → N/A
Priority: -- → P3
Attachment #9284905 - Attachment description: WIP: Bug 1778959 - Tweaks to PermissionUI to deletate gated site permissions request flows to synthetic SitePermsAddon install flow. → WIP: Bug 1778959 - Tweaks to PermissionUI to delegate gated site permissions request flows to synthetic SitePermsAddon install flow.

As a side note:

NS_IMETHODIMP
MIDIPermissionRequest::Run() {
  ...
   // If the add-on is not installed, auto-deny (except for localhost).
  if (!nsContentUtils::HasSitePerm(mPrincipal, kPermName) &&
      !BasePrincipal::Cast(mPrincipal)->IsLoopbackHost()) {
    Cancel();
    return NS_OK;
  }
  ...
}

I pulled the patches today and tried to see the various parts of the work, using navigator.requestMIDIAccess() to trigger the prompts.
If the installation of the addon doesn't go through, the promise rejects with the following error: https://searchfox.org/mozilla-central/rev/f655bdf6b4bf01b42609750ab94fc37635397260/dom/midi/MIDIPermissionRequest.cpp#62-65

I guess we'll have to tweak this a bit a it probably refers to a previous implementation

(In reply to Nicolas Chevobbe [:nchevobbe] from comment #5)

I pulled the patches today and tried to see the various parts of the work, using navigator.requestMIDIAccess() to trigger the prompts.
If the installation of the addon doesn't go through, the promise rejects with the following error: https://searchfox.org/mozilla-central/rev/f655bdf6b4bf01b42609750ab94fc37635397260/dom/midi/MIDIPermissionRequest.cpp#62-65

I guess we'll have to tweak this a bit a it probably refers to a previous implementation

yep, I totally agree, that error message would need to be tweaked accordingly to how this will be working once there isn't any website opt-in.

Honestly I think that it also be reasonable to make that error to just states that the user rejected the permission request, the developer are not going to be opting in by installing an addon in this version of the sitepermission addon type and so:

  • from a website perspective, that rejection means that the user didn't let the install flow to complete (and basically not granted the permission request)
  • from a user perspective, that error wouldn't be directly visible, and the users wouldn't definitely need to look to our extension developers docs.
Whiteboard: [addons-jira]
Depends on: 1787724
Depends on: 1788578
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED

When the pref is true, we want to go through the new SitePermissionAddon
install flow.

Depends on D151478

Depends on: 1788951
Group: mozilla-employee-confidential
Attachment #9284903 - Attachment description: WIP: Bug 1778959 - SitePermsAddonProvider basic boilerplate skeleton → Bug 1778959 - SitePermsAddonProvider basic boilerplate skeleton. r=rpl.
Attachment #9284904 - Attachment description: WIP: Bug 1778959 - Add to SitePermsAddonProvider support for synthetic addon install flow. → Bug 1778959 -Add to SitePermsAddonProvider support for synthetic addon install flow. r=rpl.
See Also: → 1789718
Attachment #9284903 - Attachment description: Bug 1778959 - SitePermsAddonProvider basic boilerplate skeleton. r=rpl. → Bug 1778959 - SitePermsAddonProvider basic boilerplate skeleton. r=rpl!,willdurand!.
Attachment #9284904 - Attachment description: Bug 1778959 -Add to SitePermsAddonProvider support for synthetic addon install flow. r=rpl. → Bug 1778959 - Add method to AddonManager for installing synthetic SitePermsAddon. r=rpl!,willdurand!.
Attachment #9292666 - Attachment description: WIP: Bug 1778959 - Don't cancel midi permission request when dom.sitepermsaddon-provider.enabled is true. r=gsvelto. → Bug 1778959 - Honor dom.sitepermsaddon-provider.enabled for Midi permission requests. r=gsvelto,rpl,willdurand.
Depends on: 1790017
Blocks: 1790084
Attachment #9284905 - Attachment description: WIP: Bug 1778959 - Tweaks to PermissionUI to delegate gated site permissions request flows to synthetic SitePermsAddon install flow. → WIP: Bug 1778959 - Tweaks to PermissionUI to delegate gated site permissions request flows to synthetic SitePermsAddon install flow. r=#permissions-reviewers!
Blocks: 1790313
Attachment #9284905 - Attachment description: WIP: Bug 1778959 - Tweaks to PermissionUI to delegate gated site permissions request flows to synthetic SitePermsAddon install flow. r=#permissions-reviewers! → Bug 1778959 - Tweaks to PermissionUI to delegate gated site permissions request flows to synthetic SitePermsAddon install flow. r=#permissions-reviewers!
Attachment #9292666 - Attachment description: Bug 1778959 - Honor dom.sitepermsaddon-provider.enabled for Midi permission requests. r=gsvelto,rpl,willdurand. → Bug 1778959 - Honor dom.sitepermsaddon-provider.enabled for Midi permission requests. r=timhuang,willdurand.
Blocks: 1790620
Blocks: 1790778
Attachment #9294627 - Attachment description: WIP: Bug 1778959 - Add requestMIDIAccess tests on localhost and file pages. → Bug 1778959 - Change requestMIDIAccess availability. r=bholley.

This will be used in SitePermsAddonInstallRequestPrototype to discriminate permission
requests coming from localhost, where we want to fallback to regular permission prompt.

Depends on D151477

Attachment #9294627 - Attachment description: Bug 1778959 - Change requestMIDIAccess availability. r=bholley. → Bug 1778959 - Don't expose requestMIDIAccess on file scheme. r=bholley.
Attachment #9295289 - Attachment description: Bug 1778959 - Expose IsPotentiallyTrustworthyLoopbackHost in nsIPrincipal. r=bholley. → Bug 1778959 - Expose nsIPrincipal.isLoopbackHost. r=bholley.
Blocks: 1792993
Keywords: dev-doc-needed
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1a68797d8bbc SitePermsAddonProvider basic boilerplate skeleton. r=rpl,willdurand. https://hg.mozilla.org/integration/autoland/rev/58083286fe3d Add method to AddonManager for installing synthetic SitePermsAddon. r=rpl,willdurand. https://hg.mozilla.org/integration/autoland/rev/2f1a9eb03661 Expose nsIPrincipal.isLoopbackHost. r=bholley. https://hg.mozilla.org/integration/autoland/rev/3913eb81b668 Tweaks to PermissionUI to delegate gated site permissions request flows to synthetic SitePermsAddon install flow. r=permissions-reviewers,pbz https://hg.mozilla.org/integration/autoland/rev/21a65ff1007c Honor dom.sitepermsaddon-provider.enabled for Midi permission requests. r=willdurand,timhuang. https://hg.mozilla.org/integration/autoland/rev/1ef96ac13291 Don't expose requestMIDIAccess on file scheme. r=bholley.

This feature is explicitly disabled in Thunderbird, in extensions.manifest, so the test doesn't work there.

A patch has been attached on this bug, which was already closed. Filing a separate bug will ensure better tracking. If this was not by mistake and further action is needed, please alert the appropriate party. (Or: if the patch doesn't change behavior -- e.g. landing a test case, or fixing a typo -- then feel free to disregard this message)

Pushed by geoff@darktrojan.net: https://hg.mozilla.org/integration/autoland/rev/a3ff2257134f Disable failing test_sitePermsAddonProvider.js in Thunderbird. r=willdurand
Blocks: 1793703
See Also: → 1741546
See Also: → 1742516
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: