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

Make this addon compatible with Firefox #53

Closed
bakulf opened this issue Jun 19, 2017 · 7 comments
Closed

Make this addon compatible with Firefox #53

bakulf opened this issue Jun 19, 2017 · 7 comments

Comments

@bakulf
Copy link

bakulf commented Jun 19, 2017

I haven't debugged it completely, but mainly the bug is in the management of Promise prototype of core-js. WebExtension APIs in Firefox are promise-based but core-js has its own implementation of Promise. This breaks everything. The solution is something like that:

diff --git a/src/app.js b/src/app.js
index 9eca865..00879f1 100644
--- a/src/app.js
+++ b/src/app.js
@@ -26,6 +26,8 @@ require('../styles/app.scss');
 // Install any necessary polyfills into global, such as es6, stage/3, stage/4, etc. as needed
 import 'core-js/es6';
 
+Promise = window.Promise;
+
 // Import the react toolkit.
 // Seems like importing 'react-dom' is not enough, we need to import 'react' as well.
 import React from 'react';

Or probably, better, don't include core-js/es6 because chrome and firefox are both es6.
I haven't checked if this breaks the addon for chrome.

I would like to thanks @rpl, who actually found the solution.

@vecna
Copy link
Member

vecna commented Jun 21, 2017

Thanks, I'll test it in the next days.

@vrde
Copy link
Collaborator

vrde commented Jun 22, 2017

WebExtension APIs in Firefox are promise-based but core-js has its own implementation of Promise. This breaks everything.

That's interesting, do you know if there is any open issue on core-js related to this bug?

Or probably, better, don't include core-js/es6 because chrome and firefox are both es6.

👍

@rpl
Copy link

rpl commented Jun 22, 2017

@vrde I consider it a Firefox bug that it should be fixed in the WebExtensions internals (I mean a library that redefines a native object should not be able to break the extension messaging APIs in a content script, especially by providing a very "not helpful" error message), and I'm going to look a bit deeper into it and file a bug on bugzilla.

Nevertheless, I was wondering why "core-js/es6" is redefining the Promise object instead of using the one provided natively, and I found these "core-js" issues that looks related:

@Mte90
Copy link

Mte90 commented Aug 3, 2017

Any news for the support?

@vecna
Copy link
Member

vecna commented Aug 4, 2017

everybody was busy, but will completed soon.

@vecna
Copy link
Member

vecna commented Aug 8, 2017

PR in #55

@vecna
Copy link
Member

vecna commented Dec 19, 2018

stable and also the revision process is not accepted smoothly.

@vecna vecna closed this as completed Dec 19, 2018
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

No branches or pull requests

5 participants