Skip to content

Commit

Permalink
Enable support for browser_specific_settings in Firefox (#6787)
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienGllmt authored and jleyba committed Jun 19, 2019
1 parent 851acb7 commit 34aedfe
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions javascript/node/selenium-webdriver/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,26 @@ async function installExtension(extension, dir) {
}

let buf = await archive.getFile('manifest.json');
let {applications} =
/** @type {{applications:{gecko:{id:string}}}} */(
JSON.parse(buf.toString('utf8')));
let parsedJSON = JSON.parse(buf.toString('utf8'));

let { browser_specific_settings } =
/** @type {{browser_specific_settings:{gecko:{id:string}}}} */
parsedJSON;

if (
browser_specific_settings &&
browser_specific_settings.gecko
) {
/* browser_specific_settings is an alternative to applications
* It is meant to facilitate cross-browser plugins since Firefox48
* see https://bugzilla.mozilla.org/show_bug.cgi?id=1262005
*/
parsedJSON.applications = browser_specific_settings;
}

let { applications } =
/** @type {{applications:{gecko:{id:string}}}} */
parsedJSON;
if (!(applications && applications.gecko && applications.gecko.id)) {
throw new AddonFormatError(`Could not find add-on ID for ${extension}`);
}
Expand Down

0 comments on commit 34aedfe

Please sign in to comment.