Closed Bug 2076009 Opened 1 month ago Closed 29 days ago

Pass add-on id/type/version through to AddonManager.getInstallForURL when known

Categories

(Toolkit :: Add-ons Manager, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
160 Branch
Tracking Status
firefox-esr153 161+ fixed
firefox160 --- fixed

People

(Reporter: kzar, Assigned: kzar)

References

Details

(Whiteboard: [addons-jira] )

Attachments

(9 external files)

We are working to harden AddonManager.getInstallForURL to enforce the add-on id, type and/or version when provided. Once that work's finished, we should go through and check the callsites, and update them to pass through those details through when known.

See Also: 1973071 →
Severity: -- → N/A

Take care to pass the expected id/type/version when installing recommended and
builtin add-ons.

Testing:

ADB extension:

  1. Launch Firefox ./mach run --temp-profile -- about:debugging#/setup
  2. Click "Enable USB Devices"
  3. Ensure "USB Enabled" is displayed after the add-on is installed.

Recommended:

  1. Launch Firefox ./mach run --temp-profile -- about:addons
  2. Click to install one of the listed recommended add-ons.
  3. Likewise for one of the recommended themes.
  4. Ensure they were both installed successfully.

Take care to pass the expected id/type/version when installing locales and
dictionaries. Also fix a bug so that telemetryInfo.source is passed correctly
when installing locales.

Testing:

  1. Launch the browser with language packs available:
./mach run --temp-profile \
  --setpref browser.settings-redesign.enabled=true \
  --setpref intl.multilingual.enabled=true \
  --setpref intl.multilingual.downloadEnabled=true \
  --setpref extensions.checkCompatibility.nightly=false \
  --setpref 'extensions.getAddons.langpacks.url=https://services.addons.mozilla.org/api/v4/addons/language-tools/?app=firefox&type=language&appversion=158.0' \
  -- 'about:preferences#languages'
  1. Click the "Preferred language" drop-down
    (if no options are listed, wait a few seconds and try again.)
  2. Select a different language (e.g. German), then click "Apply and Restart".
  3. Ensure your language was updated after the browser restarts.
  4. Navigate to about:addons, then make sure both the language pack and
    dictionary are listed and enabled for the language you picked.

Testing:

  1. Launch Firefox: ./mach run --temp-profile -- about:addons
  2. Click the "Install" button by one of the listed themes.
  3. Ensure the theme is installed and activated successfully.

Testing:

Importing:

  1. Install Dark Reader extension[1] in Google Chrome.
  2. Quit Chrome.
  3. Run Firefox: ./mach run --temp-profile -- 'about:preferences#general-migrate'
  4. Select Chrome, and click the "Import" button.
  5. Ensure at least one extension is imported. Click "Done".
  6. Navigate to about:addons#extensions and click "Install Extensions" to
    finalise the installation of the imported extension(s).

Sync:

  1. Ensure your main Firefox profile has at least one extension installed, and
    you are logged in for sync.
  2. Run Firefox: ./mach run --temp-profile.
  3. Click the hamburger menu, and then "Sign in" by "Sync and Save Data".
  4. Sign in to your account.
  5. Ensure your extensions are automatically installed.

1 - https://chromewebstore.google.com/detail/dark-reader/eimadpbcbfnmbkopoojfekhnkhdbieeh

Provide the add-on type and version for add-ons that are being installed via
enterprise policies, if known. While we're at it, let's refactor
PoliciesHelpers.installAddonFromURL() slightly, to make the parameter names
and structure more closely follow the conventions of related add-on installation
code (e.g. AddonManager.getInstallForURL()).

Testing:

  1. Write this policy.json file somewhere on disk:
{
  "policies": {
    "ExtensionSettings": {
      "addon@darkreader.org": {
        "installation_mode": "force_installed"
      }
    }
  }
}
  1. Launch Firefox with that policy:
./mach run --temp-profile \
           --setpref browser.policies.alternatePath=/PATH/TO/policy.json \
           -- about:addons
  1. Check that the Dark Reader extension was installed successfully.
See Also: → 2081274

By the way Toby, it might also be worth filing a follow-up to similarly update any other AddonManager.getInstallForURL() callsites in Thunderbird? Luca pointed out there could be a couple worth updating.

Most helpful, thanks a lot!

Pushed by rob@robwu.nl: https://github.com/mozilla-firefox/firefox/commit/d002b970fbe2 https://hg.mozilla.org/integration/autoland/rev/1a3c115b0d3f Pass expected add-on details when installing recommended+builtin add-ons r=robwu,devtools-reviewers,maxx,nchevobbe https://github.com/mozilla-firefox/firefox/commit/f77a54f6530b https://hg.mozilla.org/integration/autoland/rev/fd13ceb5ac0b Pass expected add-on details when installing locales+dictionaries r=robwu,settings-reviewers,tgiles https://github.com/mozilla-firefox/firefox/commit/1de818390fb8 https://hg.mozilla.org/integration/autoland/rev/e5d4443caca8 Pass expected add-on details when installing themes r=robwu,desktop-theme-reviewers,tgiles,mossop https://github.com/mozilla-firefox/firefox/commit/e7c2456a5f6b https://hg.mozilla.org/integration/autoland/rev/9a0acd35eab7 Pass expected add-on details when importing/syncing add-ons r=robwu https://github.com/mozilla-firefox/firefox/commit/771345a23294 https://hg.mozilla.org/integration/autoland/rev/245934a9075d Pass expected add-on details when installing through enterprise policies r=robwu,mkaply
QA Whiteboard: [qa-triage-done-c161/b160]
Attachment #9682698 - Flags: approval-mozilla-esr153?
Attachment #9682699 - Flags: approval-mozilla-esr153?
Attachment #9682700 - Flags: approval-mozilla-esr153?
Attachment #9682701 - Flags: approval-mozilla-esr153?

firefox-esr153 Uplift Approval Request

  • User impact if declined/Reason for urgency: Security hardening
  • Code covered by automated testing?: yes
  • Fix verified in Nightly?: no
  • Needs manual QE testing?: no
  • Steps to reproduce for manual QE testing:
  • Risk associated with taking this patch: low
  • Explanation of risk level: Adds extra validation for scenarios that are not supported. Covered by automated tests.
  • String changes made/needed?: none; "Is Android affected?" is No because ESR153 is desktop-only (bug 2059764).
  • Is Android affected?: no

Note the above uplift request excludes the last patch of the stack (D333218) because there was a merge conflict on ESR153 that was not too trivial to resolve. The patch (D333218) is merely a refactor without behavioral changes (there was already pre-existing logic doing the same) so I opted for excluding it for simplicity.

Attachment #9682701 - Flags: approval-mozilla-esr153? → approval-mozilla-esr153+
Attachment #9682700 - Flags: approval-mozilla-esr153? → approval-mozilla-esr153+
Attachment #9682699 - Flags: approval-mozilla-esr153? → approval-mozilla-esr153+
Attachment #9682698 - Flags: approval-mozilla-esr153? → approval-mozilla-esr153+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: