Skip to content

Instantly share code, notes, and snippets.

@sefeng211
Last active February 14, 2020 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sefeng211/bb8c8ac9b58d19ee4ce520102136dd47 to your computer and use it in GitHub Desktop.
Save sefeng211/bb8c8ac9b58d19ee4ce520102136dd47 to your computer and use it in GitHub Desktop.
Apply this patch to node_modules/selenium-webdriver/firefox/extension.js
--- node_modules/selenium-webdriver/firefox/extension.js 2019-04-23 17:15:51.000000000 -0400
+++ extension_new.js 2020-02-14 13:27:28.221885022 -0500
@@ -176,6 +176,14 @@
return {id: applications.gecko.id, name, version, unpack: false};
}
+ function setApplication(parsedJSON) {
+ let { browser_specific_settings } = parsedJSON;
+ if (browser_specific_settings && browser_specific_settings.gecko) {
+ parsedJSON.applications = browser_specific_settings;
+ }
+ return parsedJSON;
+ }
+
function parseXpiFile(filePath) {
return zip.load(filePath).then(archive => {
if (archive.has('install.rdf')) {
@@ -186,6 +194,7 @@
if (archive.has('manifest.json')) {
return archive.getFile('manifest.json')
.then(buf => JSON.parse(buf.toString('utf8')))
+ .then(setApplication)
.then(parseManifestJson);
}
@@ -208,6 +217,7 @@
if (jsonExists) {
return io.read(jsonPath)
.then(buf => JSON.parse(buf.toString('utf8')))
+ .then(setApplication)
.then(parseManifestJson);
}
throw new AddonFormatError(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment