Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
detect browser_specific_settings as pseudonym of applications in …
- Loading branch information
|
|
@@ -327,7 +327,7 @@ def check_xpi_file_contents(self, xpi_file_path, expected_version): |
|
|
manifest = xpi.read('manifest.json') |
|
|
manifest_json = json.loads(manifest) |
|
|
assert ( |
|
|
manifest_json['applications']['gecko']['id'] == |
|
|
manifest_json['browser_specific_settings']['gecko']['id'] == |
|
|
self.addon.guid) |
|
|
assert manifest_json['version'] == expected_version |
|
|
expected_dict_obj = {'ar': 'dictionaries/ar.dic'} |
|
|
|
|
|
@@ -292,7 +292,7 @@ def build_webext_dictionary_from_legacy(addon, destination): |
|
|
manifest = { |
|
|
'manifest_version': 2, |
|
|
'name': unicode(addon.name), |
|
|
'applications': { |
|
|
'browser_specific_settings': { |
|
|
'gecko': { |
|
|
'id': addon.guid, |
|
|
}, |
|
|
|
|
|
@@ -416,6 +416,9 @@ |
|
|
# The default version of Firefox that supports WebExtensions without an id |
|
|
DEFAULT_WEBEXT_MIN_VERSION_NO_ID = '48.0' |
|
|
|
|
|
# The default version of Firefox that supported `browser_specific_settings` |
|
|
DEFAULT_WEBEXT_MIN_VERSION_BROWSER_SPECIFIC = '48.0' |
|
|
|
|
|
# The version of Firefox that first supported static themes. Not Android yet. |
|
|
DEFAULT_STATIC_THEME_MIN_VERSION_FIREFOX = '53.0' |
|
|
|
|
|
|
|
|
@@ -155,13 +155,20 @@ def test_instanciate_without_data(self): |
|
|
extractor = utils.ManifestJSONExtractor(zipfile.ZipFile(fake_zip)) |
|
|
assert extractor.data == data |
|
|
|
|
|
def test_guid(self): |
|
|
def test_guid_from_applications(self): |
|
|
"""Use applications>gecko>id for the guid.""" |
|
|
assert self.parse( |
|
|
{'applications': { |
|
|
'gecko': { |
|
|
'id': 'some-id'}}})['guid'] == 'some-id' |
|
|
|
|
|
def test_guid_from_browser_specific_settings(self): |
|
|
"""Use applications>gecko>id for the guid.""" |
|
|
assert self.parse( |
|
|
{'browser_specific_settings': { |
|
|
'gecko': { |
|
|
'id': 'some-id'}}})['guid'] == 'some-id' |
|
|
|
|
|
def test_name_for_guid_if_no_id(self): |
|
|
"""Don't use the name for the guid if there is no id.""" |
|
|
assert self.parse({'name': 'addon-name'})['guid'] is None |
|
|
@@ -258,6 +265,16 @@ def test_apps_use_default_versions_if_none_provided(self): |
|
|
assert app.min.version == amo.DEFAULT_WEBEXT_MIN_VERSION |
|
|
assert app.max.version == amo.DEFAULT_WEBEXT_MAX_VERSION |
|
|
|
|
|
# But if 'browser_specific_settings' is used, it's higher min version. |
|
|
data = {'browser_specific_settings': {'gecko': {'id': 'some-id'}}} |
|
|
apps = self.parse(data)['apps'] |
|
|
assert len(apps) == 1 # Only Firefox for now. |
|
|
app = apps[0] |
|
|
assert app.appdata == amo.FIREFOX |
|
|
assert app.min.version == ( |
|
|
amo.DEFAULT_WEBEXT_MIN_VERSION_BROWSER_SPECIFIC) |
|
|
assert app.max.version == amo.DEFAULT_WEBEXT_MAX_VERSION |
|
|
|
|
|
def test_is_webextension(self): |
|
|
assert self.parse({})['is_webextension'] |
|
|
|
|
|
|
|
|
@@ -387,8 +387,11 @@ def is_experiment(self): |
|
|
|
|
|
@property |
|
|
def gecko(self): |
|
|
"""Return the "applications["gecko"]" part of the manifest.""" |
|
|
return self.get('applications', {}).get('gecko', {}) |
|
|
"""Return the "applications|browser_specific_settings["gecko"]" part |
|
|
of the manifest.""" |
|
|
parent_block = self.get( |
|
|
'browser_specific_settings', self.get('applications', {})) |
|
|
return parent_block.get('gecko', {}) |
|
|
|
|
|
@property |
|
|
def guid(self): |
|
|
@@ -433,8 +436,12 @@ def apps(self): |
|
|
(amo.FIREFOX, amo.DEFAULT_WEBEXT_DICT_MIN_VERSION_FIREFOX), |
|
|
) |
|
|
else: |
|
|
webext_min = ( |
|
|
amo.DEFAULT_WEBEXT_MIN_VERSION |
|
|
if self.get('browser_specific_settings', None) is None |
|
|
else amo.DEFAULT_WEBEXT_MIN_VERSION_BROWSER_SPECIFIC) |
|
|
apps = ( |
|
|
(amo.FIREFOX, amo.DEFAULT_WEBEXT_MIN_VERSION), |
|
|
(amo.FIREFOX, webext_min), |
|
|
(amo.ANDROID, amo.DEFAULT_WEBEXT_MIN_VERSION_ANDROID), |
|
|
) |
|
|
|
|
|
|