Skip to content

Commit

Permalink
Merge pull request SeleniumHQ#1 from back-office/fix-adding-extensions
Browse files Browse the repository at this point in the history
Read Firefox Extension ID from appropriate location in manifest.json
  • Loading branch information
michaelpreston authored and GitHub Enterprise committed Jan 15, 2020
2 parents 2ecb7d9 + c800db7 commit d38a83f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rb/lib/selenium/webdriver/firefox/extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ def read_id_from_manifest_json(directory)
return unless File.exist?(manifest_path)

manifest = JSON.parse(File.read(manifest_path))
gecko_id(manifest) || name_and_version(manifest)
end

def gecko_id(manifest)
manifest.dig('browser_specific_settings', 'gecko', 'id')&.strip
end

def name_and_version(manifest)
[manifest['name'].delete(' '), manifest['version']].join('@')
end
end # Extension
Expand Down

0 comments on commit d38a83f

Please sign in to comment.