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

Using the inline worker emits errors in browser context. #8

Closed
Kanaye opened this issue Jan 31, 2018 · 0 comments
Closed

Using the inline worker emits errors in browser context. #8

Kanaye opened this issue Jan 31, 2018 · 0 comments

Comments

@Kanaye
Copy link
Contributor

Kanaye commented Jan 31, 2018

TypeError
Failed to execute 'postMessage' on 'Window': 2 arguments required, but only 1 present.

is thrown in the normal browsers window context because window.postMessage expects 2 arguments and is called with one here:

if (typeof postMessage==='function') postMessage(sendQueue);

The easiest way to fix this, is to add extend the condition to be:
if (typeof postMessage === 'function' && postMessage.length === 1)

I'll probably PR later, but I'm documenting my findings while I'm debugging an other error.

Edit: Example emitting this error: https://codesandbox.io/s/10r1j4z06l

Kanaye added a commit to Kanaye/stockroom that referenced this issue Jan 31, 2018
This prevents calling window.postMessage accidently when using the
"inline" version within a normal browser.

Closes developit#8
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

1 participant