evothings / evothings-studio

Evothings Studio
http://www.evothings.com/
Apache License 2.0
53 stars 33 forks source link

node.js exception when giving the hyper.log function non-character data. #62

Closed TechWizEric closed 9 years ago

TechWizEric commented 9 years ago

When on the mobile device giving the hyper.log function non-character data, e.g. some UTF-8 encoded binary data, a node.js exception occurs in the Workbench. The following error message is shown in the Workbench window.

Uncaught node.js Error 

Error: Failed to execute 'postMessage' on 'Window': An object could not be cloned.
    at Error (native)
    at file:///Applications/EvothingsStudio_Mac_64_1.1.3/hyper/ui/hyper-ui.js:476:22
    at displayLogMessage (/Applications/EvothingsStudio_Mac_64_1.1.3/hyper/server/hyper-server.js:717:3)
    at Socket.<anonymous> (/Applications/EvothingsStudio_Mac_64_1.1.3/hyper/server/hyper-server.js:780:4)
    at Socket.EventEmitter.emit (events.js:104:17)
    at Socket.onevent (/Applications/EvothingsStudio_Mac_64_1.1.3/node_modules/socket.io/lib/socket.js:327:8)
    at Socket.onpacket (/Applications/EvothingsStudio_Mac_64_1.1.3/node_modules/socket.io/lib/socket.js:291:12)
    at Client.ondecoded (/Applications/EvothingsStudio_Mac_64_1.1.3/node_modules/socket.io/lib/client.js:185:14)
    at Decoder.Emitter.emit (/Applications/EvothingsStudio_Mac_64_1.1.3/node_modules/component-emitter/index.js:134:20)
    at Decoder.add (/Applications/EvothingsStudio_Mac_64_1.1.3/node_modules/socket.io-parser/index.js:257:14)
fredrikeldh commented 9 years ago

We need to know what kind of object this is, that can not be cloned. You may test using hyper.log() and NODE EVAL in the Tools window.

ghost commented 9 years ago

Passing in function objects causes this crash when doing EVAL on a device. NODE EVAL works.

fredrikeldh commented 9 years ago

The definition of hyper.log is found in HyperReload, here. It should be easily fixable by wrapping message in a String().

fredrikeldh commented 9 years ago

Fixed in commit 198749f3e38f36e8d117ef67ecadc31f302177dd.