Bug 1572404 - [mozprofile] install addon with browser_specific_settings r=whimboo

webextensions now uses "browser_specific_settings" instead of "applications" in
the manifest file. This patch make mozprofile look for both places.

Differential Revision: https://phabricator.services.mozilla.com/D42457

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tarek Ziadé 2019-08-20 09:16:54 +00:00
Родитель d465357990
Коммит 2097876b46
3 изменённых файлов: 22 добавлений и 3 удалений

Просмотреть файл

@ -284,9 +284,15 @@ class AddonManager(object):
if is_webext:
details['version'] = manifest['version']
details['name'] = manifest['name']
# Bug 1572404 - we support two locations for gecko-specific
# metadata.
for location in ('applications', 'browser_specific_settings'):
try:
details['id'] = manifest['applications']['gecko']['id']
details['id'] = manifest[location]['gecko']['id']
break
except KeyError:
pass
if details['id'] is None:
details['id'] = cls._gen_iid(addon_path)
details['unpack'] = False
else:

Двоичный файл не отображается.

Просмотреть файл

@ -83,6 +83,19 @@ def test_install_webextension(am):
assert 'test-webext@quality.mozilla.org' == details['id']
def test_install_webextension_id_via_browser_specific_settings(am):
# See Bug 1572404
addon = os.path.join(here, 'addons', 'apply-css-id-via-browser-specific-settings.xpi')
am.install(addon)
assert len(am.installed_addons) == 1
assert os.path.isfile(am.installed_addons[0])
assert ('apply-css-id-via-browser-specific-settings.xpi' ==
os.path.basename(am.installed_addons[0]))
details = am.addon_details(am.installed_addons[0])
assert 'test-webext@quality.mozilla.org' == details['id']
def test_install_webextension_sans_id(am):
addon = os.path.join(here, 'addons', 'apply-css-sans-id.xpi')
am.install(addon)