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

PostMessage to worker failed if target passed in configuration #102

Closed
nicolas-rempulski opened this issue Mar 31, 2016 · 1 comment
Closed

Comments

@nicolas-rempulski
Copy link

Hi,

I encountered a problem when a specific "target" is used in the configuration object. I paste here what I've said in #94 :

As soon as quagga start, an error is thrown

Uncaught DataCloneError: Failed to execute 'postMessage' on 'Worker': An object could not be cloned.

thrown by

        workerThread.worker.postMessage({
            cmd: 'init',
            size: { x: _inputStream.getWidth(), y: _inputStream.getHeight() },
            imageData: workerThread.imageData,
            config: _config
        }, [workerThread.imageData.buffer]);

I read, on threads about workers, that this error can be generated if a postMessage try to pass a parameter which is an object and this object has functions.

I think the error isthrown because HTMLElement specified in "target" is a complex object that the browser can't clone. If I remove it, and thus the _config passed in postMessage doesn't contain it, it works like a charm.

A solution may be to strip _config.target from config passed to workers

I take this opportunity to thank you for great work on quaggaJS, really useful plugin with a neat usability.

@serratus
Copy link
Owner

serratus commented Apr 5, 2016

Thanks for reporting this bug. This is indeed a problem caused if the target is an HTML element. I'll try to remove it from the configuration which is passed into the worker. Good idea. I'll let you know as soon as it is fixed.

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

2 participants