Skip to content

Commit

Permalink
Add a method to parse a WebExtensions manifest.json file.
Browse files Browse the repository at this point in the history
  • Loading branch information
sangaline authored and davehunt committed Oct 4, 2018
1 parent 4c53c96 commit e5f777a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions py/selenium/webdriver/firefox/firefox_profile.py
Expand Up @@ -330,6 +330,16 @@ def get_text(element):
rc.append(node.data)
return ''.join(rc).strip()

def parse_manifest_json(content):
"""Extracts the details from the contents of a WebExtensions `manifest.json` file."""
manifest = json.loads(content)
return {
'id': manifest['applications']['gecko']['id'],
'version': manifest['version'],
'name': manifest['version'],
'unpack': False,
}

if not os.path.exists(addon_path):
raise IOError('Add-on path does not exist: %s' % addon_path)

Expand Down

0 comments on commit e5f777a

Please sign in to comment.