Skip to content
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

Example of Chrome/Firefox compatible extension with polyfill #131

Closed
wants to merge 3 commits into from

Conversation

jeffesquivels
Copy link

No description provided.

Jeffrey Esquivel S and others added 2 commits October 26, 2016 23:54
Adds a Chrome/Firefox compatible extension to demonstrate the use of the
WebExtension browser API Polyfill.

Closes mdn#105.
@jeffesquivels
Copy link
Author

jeffesquivels commented Oct 31, 2016

@kumar303 @wbamberg this is a first attempt to use promises instead of callbacks, it is currently working on FF, but I get this error on Chromiun (version 53.0.2785.143):

screenshot from 2016-10-31 01-44-53

I'm sure there's something I'm missing here, could you point me in the right direction? (I also researched and used the arrow function expression first, as it was used a lot in the docs I read about promises, but when that failed, I reverted to the simplest example I could think of that still used promises instead of callbacks).

Thanks,

@kumar303
Copy link
Contributor

@kmaglione does this Chrome error look like a bug we should file in https://github.com/mozilla/webextension-polyfill?

@kmaglione
Copy link

The problem is that you used the source file rather than building and using the final build in dist/browser-polyfill.js

@kumar303
Copy link
Contributor

kumar303 commented Nov 7, 2016

@kmaglione d'oh, I missed that. Thanks for taking a closer look.

@jeffesquivels this explains how to build a version of the polyfill that you can safely include: https://github.com/mozilla/webextension-polyfill#building

@jeffesquivels
Copy link
Author

@kmaglione thanks for the clarification, I'm a JS rookie and dind't realized there were source js files that needed to be built :).

@kumar303 thanks for the link, I'm installing npm right now.

BTW, thinking about forward compatibility, what would be the correct way to include the polyfill so that we're always using the latest version?

I was thinking using git submodules, but if there's a building phase then that wouldn't work automagically for people. Or would it make more sense (because we're just providing examples) that we just manually update the file in the repo now and then, what do you think?

Thanks.

@kumar303
Copy link
Contributor

what would be the correct way to include the polyfill so that we're always using the latest version?

Good question. I think your current approach is the best way but you could add a comment in the readme warning that polyfill upgrades will need to be done manually. I filed this bug to address polyfill upgrades better: mozilla/webextension-polyfill#7

I was thinking using git submodules

Those are kind of painful in my experience so I don't think it's worth it.

@wbamberg
Copy link

Closing, as this PR hasn't seen any activity in a while.

@wbamberg wbamberg closed this May 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants