woodruffw / ff2mpv

A Firefox/Chrome add-on for playing URLs in mpv.
https://addons.mozilla.org/en-US/firefox/addon/ff2mpv/
Other
521 stars 52 forks source link

Fix/dynamic context menu #118

Closed DanSM-5 closed 8 months ago

DanSM-5 commented 8 months ago

I did some test on my steam deck for https://github.com/woodruffw/ff2mpv/issues/116 and I found the following error on brave browser: image

It happens because on browser launch it will try to remove the ff2mpv context menu without it being added previously. However this didn't affect the browser to add the "Play in MPV" or "Profiles" context menu. I didn't observe any error in firefox but something similar may be happening.

I've wrapped the calls for browser.contextMenus.remove in a try/catch block to prevent any further issue.

Additionally I've wrapped the functions getProfiles and getOptions in try/catch blocks in case any of those caused an unexpected error.

woodruffw commented 8 months ago

Thanks @DanSM-5!

DanSM-5 commented 8 months ago

Weird. LGTM, although I'd love to understand why this would happen on some agents and not others (since I haven't seen it).

I can't say for sure. Maybe something to do in the way that browser-polyfill handles the apis in chromium.