-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 support for Chrome Apps and WebExtensions #3946
Add support for Chrome Apps and WebExtensions #3946
Conversation
First, I am not sure I want to support this use case. Can you give me an example where doing so would make sense? What kind of app would you be building with it? Second, experience tells me this is not the only thing stopping it from working properly. We've gone through this with joi and other modules that required a lot of changes to work properly. |
Real live example: js-ipfs in Brave browser (ipfs/ipfs-companion#716) js-ipfs is using Hapi to expose HTTP2IPFS Gateway. Brave whitelisted our browser extension to have access to We tested it in practice and it works as expected (ipfs/ipfs-companion#664 (comment)). We use chrome-net and http-node to polyfill calls to The only remaining issue with Hapi was the Stream detection, and change from this PR solved that (we use code form this PR). Stream-related entries from |
Thanks for the background. I hope to get to it this week and let you know if/how I can support it. |
Anything I can do to help with evaluating this? |
ccbf84b
to
fb8626f
Compare
Detection via `stream instanceof Stream` does not work correctly in browser context, especially when different polyfils are used and mixed together. This change replaces instanceof check with feature-detection of stream-like objects. It enables Hapi to be used in Chrome Apps (browser environments with additional chrome.sockets APIs) Real life example: ipfs/ipfs-companion#664
fb8626f
to
0d73f8d
Compare
Release includes support for Chrome Apps and WebExtensions: hapijs/hapi#3946
Release includes support for Chrome Apps and WebExtensions: hapijs/hapi#3946
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
Stream detection via
stream instanceof Stream
does not work correctly in browser contexts such as Chrome Apps or WebExtensions in browsers exposingchrome.sockets
, especially when differentstream
polyfils are used and mixed together.This change replaces
instanceof Stream
checks with feature-detection of stream contract, enabling Hapi to be used in browserified form in Chrome Apps and other browser environments.cc ipfs/ipfs-companion#716