Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/scripts/extensions/webExtensionBase/webExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ export class WebExtension extends ExtensionBase<WebExtensionWorker, W3CTab, numb
}

protected onFirstRun() {
// Don't do anything since we're using the onInstalled functionality instead
// Don't do anything since we're using the onInstalled functionality instead, unless it's not available
// then we use our 'missing-clipperId' heuristic
if (!this.onInstalledSupported()) {
this.onInstalled();
}
}

protected checkIfTabMatchesATooltipType(tab: W3CTab, tooltipType: TooltipType): boolean {
Expand Down Expand Up @@ -158,7 +162,7 @@ export class WebExtension extends ExtensionBase<WebExtensionWorker, W3CTab, numb

private registerInstallListener() {
// onInstalled is undefined as of Firefox 48
if (WebExtension.browser.runtime.onInstalled) {
if (this.onInstalledSupported()) {
WebExtension.browser.runtime.onInstalled.addListener(details => {
if (details.reason === "install") {
this.onInstalled();
Expand All @@ -175,4 +179,8 @@ export class WebExtension extends ExtensionBase<WebExtensionWorker, W3CTab, numb
}
});
}

private onInstalledSupported(): boolean {
return !!WebExtension.browser.runtime.onInstalled;
}
}