Use MessageChannel to support Chrome <51, test with localtunnel.me for https #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #7
MessageChannels are preferred in the case of Service Workers, because
event.source
isnull
in Chrome < 51 (bug), which means you can receive messages but can't send any back. This can be revisited once Chrome <51 drops to low usage numbers and we can just switch toevent.source
, but for now this works in Chrome 42+ and in Firefox. For Web Workers, I stick with the old system and avoid unnecessary MessageChannel creation.I also needed some way of actually testing Service Workers to prevent regressions, meaning I needed Zuul to run over HTTPS. I decided to go with localtunnel.me because ngrok, although it also offered https, was too restrictive with the concurrent number of tunnels. I tested manually and confirmed that this is actually testing HTTPS and actually testing Service Worker.
Unfortunately I had to set the tested Chrome versions to 42+ because, although Service Worker is in 40 and 41, it has some bug in MessageChannels that breaks the test (no time to debug to figure out what the issue was). Luckily Chrome 40 and 41 have very low usage.