summaryrefslogtreecommitdiff
path: root/runtime/js/11_workers.js
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/js/11_workers.js')
-rw-r--r--runtime/js/11_workers.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/js/11_workers.js b/runtime/js/11_workers.js
index 57f420728..e943d66bc 100644
--- a/runtime/js/11_workers.js
+++ b/runtime/js/11_workers.js
@@ -47,6 +47,13 @@
}
function decodeMessage(dataIntArray) {
+ // Temporary solution until structured clone arrives in v8.
+ // Current clone is made by parsing json to byte array and from byte array back to json.
+ // In that case "undefined" transforms to empty byte array, but empty byte array does not transform back to undefined.
+ // Thats why this special is statement is needed.
+ if (dataIntArray.length == 0) {
+ return undefined;
+ }
const dataJson = decoder.decode(dataIntArray);
return JSON.parse(dataJson);
}