-
Notifications
You must be signed in to change notification settings - Fork 180
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
iframe in Firefox: Uncaught (in promise) ReferenceError: browser is not defined #256
Comments
You can try a custom build of this repository with webextension-polyfill to make it cross browser compatible. You can try with following modification and it should work. package: https://github.com/mozilla/webextension-polyfill#basic-setup edit: https://github.com/tshaddix/webext-redux/blob/master/src/util.js
@tshaddix what are you thoughts? |
@CodeDem This makes a lot of sense to me, especially if the polyfill is being actively maintained. If you'd like to submit a PR I'd be happy to look at it! Thank you for this! |
@tshaddix yes this worked nicely. I used it in my recent browser plugin development. I'll make a PR for this |
@CodeDem Great! Thank you! |
Might be a little late to the party, but I believe iframes are not really very recommended (it's basically embedding a full-fledged HTML document inside the parent HTML, and therefore, not very performant, not to mention being a tad complex, at least for my taste/code-style). Idk a ton about web-dev, but this reasoning seems pretty sound to me. If anyone has anything else on this matter, please do comment here! @anotherstarburst I'm assuming you don't want CSS and/or other scripting conflicts with the parent HTML, and that's the reason for iframes? If this is indeed the case, might I suggest you having a look at Shadow DOMs? They're basically isolated little DOM nuggets, quite performant and easier to handle than iframes. If this does seem like a usable choice, you might also want to have a look at the react-shadow package, which does exactly what it says on the tin. It's pretty dang awesome. If you want any help with setting it up, lemme know! Will be more than willing to help. @CodeDem wow, awesome stuff! Can't wait to use a nice, polyfilled package in production! 😍 |
Oh yes, I’ve started the work on the same. Chrome browser api are callback based and the Mozilla web extension pollyfill browser api is Promise based. So have to do some more changes accordingly. I might need some help with writing test cases. I’ll update you guys on the progress soon. |
Hi @tshaddix
I love this project. I've been test driving it for an app and came across an issue I can't quite get to the bottom of. Hopefully you have a better feel for how to solve it?
What I expect to happen
I'm injecting an iframe into a page, and the content of said iframe is able to access the redux store.
What actually happens
This works as expected in Chrome, however when I run this in Firefox it throws the following error:
Uncaught (in promise) ReferenceError: browser is not defined
which links to https://github.com/tshaddix/webext-redux/blob/536e12689deea53c92ddffd8bdee15f733f0146b/src/util.js
Steps to reproduce
I've put together a simple web extension so you can reproduce the issue at your leisure: https://github.com/anotherstarburst/webext-redux-issue
Notes
Curious to know your thoughts on what might be giving rise to this?
The text was updated successfully, but these errors were encountered: