WofWca / jumpcutter

⏩ Fast-forwards long pauses between sentences — watch lectures ~1.5x faster (browser extension)
https://chrome.google.com/webstore/detail/jump-cutter/lmppdpldfpfdlipofacekcfleacbbncp
GNU Affero General Public License v3.0
356 stars 13 forks source link

fix: if `onInstalled` listener fails, "toggle" hotkey won't work #92

Open WofWca opened 2 years ago

WofWca commented 2 years ago

https://github.com/WofWca/jumpcutter/blob/81b4e507b68d9f7c50e90161326edc65038ae28c/src/entry-points/background/main.ts#L46-L81

If there was an update of the extension (i.e. browser.runtime.onInstalled.addListener listener gets called), then, if it doesn't finish and then the browser is closed, initBrowserHotkeysListener initIconAndBadgeUpdater will not be called until the next update.

This seems to me like the browser.runtime.onInstalled API is poorly designed, requiring us to make this postInstallDonePromise. Or could we just remove the onInstalled listener and just execute migrations every time __lastHandledUpdateToVersion is not equal to the version from the manifest?

This is not normal for the listener to fail thought, so it's not very important.