-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add partial support for Chromium browsers #3
base: main
Are you sure you want to change the base?
Add partial support for Chromium browsers #3
Conversation
This adds partial support for chromium-based browsers (including Chrome). `window.browser` is only defined in firefox but `window.chrome` is available both in firefox and chromium and works just the same. This only partially supports chromium as `loadReplace` is not supported in chromium: - https://github.com/dmlls/yang/blob/6dd101e9a27e8620ffe8fa7641b00ee8e8ef42e8/background.js#L92 - https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/Tabs/update#browser_compatibility
Hi @NyanKiyoshi, thanks a lot for the PR! Even though Firefox does support So how do we feel about following MDN recommendations (see link above) and using WebExtension browser API Polyfill? I know at this point this is a bit like killing a fly with a sledgehammer, but the extension will likely grow overtime (e.g., custom bangs are next), and using About |
@NyanKiyoshi since you opened the PR, would you like to add the polyfill? It should be straightforward following the MDN docs. Since releases are not that frequent, I suggest we simply include the |
Hi @dmlls, thank you for the details. I wasn't aware about those differences between the two implementations; it is indeed concerning as, just like you mentioned, it may negatively impact what your project can do in the future. I will try to find some time in the coming days or weeks to introduce the polyfill library. I will also look deeper into the I'm also aware that Google Chrome is throwing warnings as the project is using manifest v2 instead of v3 since Google Chrome deprecated the old manifest. It seems like it would be possible to easily upgrade but I would think it should be tackled as a separate PR and thus could be a technical debt/feature request to upgrade it. I do notice that Brave doesn't put such warnings, perhaps not all Chromium vendors are deprecating it. |
@NyanKiyoshi so actually, after reading mozilla/webextension-polyfill#329 and the other issues that reference it, apparently the polyfill won't be of help anymore with MV3. I wonder if then we should just focus on migrating to MV3 directly to avoid working twice in the future... Might be especially a good idea in the current state of the project, given that there are less than 100 lines of code to migrate. I can open a PR in the following days and then it would be great if you could test it on Chrome. Does that sound good to you? |
@dmlls sounds great 👍 |
This adds partial support for chromium-based browsers (including Google Chrome).
window.browser
is only defined in firefox butwindow.chrome
is available both in firefox and chromium and works just the same.This only partially supports chromium as
loadReplace
is not supported in chromium:yang/background.js
Line 92 in 6dd101e
I am not aware of workarounds for
loadReplace
, thus to make it work on chromium-based browsers it requires to remove the line.Tested on: