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

fix: feature detection for Google Chrome #16

Merged
merged 1 commit into from
Sep 10, 2019

Conversation

lidel
Copy link
Contributor

@lidel lidel commented Sep 8, 2019

This is the same fix as feross/chrome-net#36

What?

This PR adds explicit check if chrome.sockets.udp exist before registering related listeners.

Why?

chrome-dgram did not check if chrome.sockets.udp APIs actually exist, which caused problems in browser extensions, making it difficult to maintain a single codebase and do feature-detection at runtime (namely, Google Chrome without chrome.sockets.udp vs Brave with).

Refs. feross/chrome-net#36, ipfs/ipfs-companion#664 ipfs/ipfs-companion#716

Old version did not check if chrome.sockets.udp actually exist.
This caused problems with extensions built for Chromium-based browsers
that tried to maintain the single codebase and do feature-detection
at runtime.

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
lidel added a commit to ipfs/ipfs-companion that referenced this pull request Sep 9, 2019
Improved detection of chrome.sockets.udp
feross/chrome-dgram#16
Copy link
Owner

@feross feross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@feross feross merged commit d106698 into feross:master Sep 10, 2019
@feross
Copy link
Owner

feross commented Sep 10, 2019

3.0.3

@lidel lidel deleted the fix/chrome-compat branch September 10, 2019 12:54
lidel added a commit to ipfs/ipfs-companion that referenced this pull request Sep 11, 2019
Improved detection of chrome.sockets.udp
feross/chrome-dgram#16
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.

2 participants