-
Notifications
You must be signed in to change notification settings - Fork 215
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
How not to include in Firefox #55
Comments
The polyfill is already guarded on
If you don't want to load the file at all, you can either modify you build script to not include the polyfill or use an empty file instead of the polyfill, or use |
thank you for your quick answer.
yes, I have been including the polyfill unconditionally for some time without trouble in another add-on. Still, it bothers me to include code I don't need. Additionally, I get a lint warning when I do it:
Nothing serious here. It would just be nicer not to include it.
if I do that, how do you suggest to adapt this code? async function sendScript (tabId) {
await browser.tabs.executeScript(tabId, {file: '/browser-polyfill.min.js'})
await browser.tabs.executeScript(tabId, {file: '/content-script.js'})
}
that's a bit ugly, but the best solution I have heard so far. Thanks :-).
that's not going to work here as the code which sends the content-script already knows about |
You could save the result of |
Like this? (I did not test it though)
|
@asamuzaK IIUC, you are proposing to distinguish the browser through the extension ID as it is going to differ from a browser to another one. This is smart. Thanks. |
By the way, you don’t need to await |
We have documented that the extension does not do anything in Firefox: https://github.com/mozilla/webextension-polyfill#issues-that-happen-only-when-running-on-firefox If you somehow want to detect Firefox / Chrome based on API behavior, then the approach in #55 (comment) can be used (among others). |
My add-on sends webextension-polyfill dynamically to the active tab from a popup or sidebar. I would like to stop including the polyfill in Firefox releases of my add-on. How can I not send the polyfill in Firefox while still sending it to Chromium?
The text was updated successfully, but these errors were encountered: