Skip to content

Commit

Permalink
Update to work with Firefox 67 (compatibility with https://bugzilla.m…
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVallat committed Mar 19, 2019
1 parent e5ac5a1 commit 298e3ab
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
19 changes: 13 additions & 6 deletions legacyHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const { utils: Cu , classes: Cc, interfaces: Ci} = Components;

const globalMessageManager = Cc["@mozilla.org/globalmessagemanager;1"].getService();

ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");

//ChromeUtils.import("resource://gre/modules/Timer.jsm");

Expand Down Expand Up @@ -231,13 +231,20 @@ this.legacy = class extends ExtensionAPI {
// Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1460555
async workaround1406055() {
if (context.extension.startupReason === "APP_STARTUP") {
ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
const {AddonManager} = ChromeUtils.import("resource://gre/modules/AddonManager.jsm");

AddonManager.getAddonsByTypes(["extension"]).then(addons => {
for (const addon of addons) {
if (addon.isActive && addon.dependencies.includes("[email protected]")) {
addon.reload();
}
if (addon.dependencies.includes("[email protected]")) {
if (addon.isActive || addon.isActive === undefined) {
console.log("Legacy Helper reloading addon: " + addon.name, addon);
addon.reload();
} else {
console.log("Skipping addon: " + addon.name, addon.isActive, addon);
}
} else {
console.log("Skipping non-legacy addon: " + addon.name);
}
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"manifest_version": 2,
"name": "Legacy Helper",
"version": "0.1",
"version": "0.2",
"description": "Provides support for webextensions to access legacy-restricted functionality",
"author": "Alex Vallat",

"applications": {
"gecko": {
"id": "[email protected]",
"strict_min_version": "60.0",
"strict_min_version": "67.0",
"update_url": "https://raw.githubusercontent.com/AlexVallat/LegacyHelper/master/updates.json"
}
},
Expand Down
26 changes: 15 additions & 11 deletions updates.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{
"addons": {
"[email protected]": {
"updates": [
{
"version": "0.1",
"update_link": "https://github.com/AlexVallat/LegacyHelper/releases/download/v0.1/LegacyHelper.xpi"
}
]
}
}
{
"addons": {
"[email protected]": {
"updates": [
{
"version": "0.1",
"update_link": "https://github.com/AlexVallat/LegacyHelper/releases/download/v0.1/LegacyHelper.xpi"
},
{
"version": "0.2",
"update_link": "https://github.com/AlexVallat/LegacyHelper/releases/download/v0.2/LegacyHelper.xpi"
}
]
}
}
}

0 comments on commit 298e3ab

Please sign in to comment.