Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #21444

Re: Javascript postMessage Syntax Error DOM Exception in Web Worker Code

Newsgroups comp.lang.javascript
Date 2013-09-27 08:52 -0700
References <943c4469-b974-4dbc-8da5-75a4a04be456@googlegroups.com>
Message-ID <a595ebd6-6fc3-4a58-9981-2ca7bebc2d9b@googlegroups.com> (permalink)
Subject Re: Javascript postMessage Syntax Error DOM Exception in Web Worker Code
From dman777 <darin.hensley@gmail.com>

Show all headers | View raw


On Friday, September 27, 2013 10:09:24 AM UTC-5, dman777 wrote:
> I am using Javascript Web Workers. In the web worker, I have:
> 
> 
> 
> function makeRequestChat(id) {
> 
>     var jsonObj;
> 
>     var xml = new XMLHttpRequest();
> 
>     xml.open("POST", "/site/myapp/" + id, true);
> 
>     xml.onreadystatechange = function () {
> 
>         if (xml.readyState === 4 && xml.status === 200){
> 
>             var jsonObj = JSON.parse(xml.responseText, function (key,value) { parseChat(key, value, id); });
> 
>             var foo = chatQueues[id];
> 
>             foo.queue = id;
> 
>             var bar = JSON.stringify(foo);
> 
>             postMessage(bar);
> 
> 
> 
>         }
> 
>     }
> 
>     xml.send(null);
> 
> }
> 
> I am using copy for sending the json string. I get Uncaught Error: SyntaxError: DOM Exception 12 get.js:28 xml.onreadystatechange. This is specifically at  postMessage(bar). This is strange there is nothing DOM related in this web workers code. I really need to get rid of this error if anyone can please help!
> 
> 
> 
> Here is the json string being returned to main:
> 
>  "{"active":0,"unanswered":0,"available":3,"queue":"uk"}"
> 
> 
> 
> I am desperate to get rid of this error if anyone can please help.

Hello,

Thank you for your reply. I get this in chromium Version 28.0.1500.71 (209842). When I try this in firefox, I do not get this error. But I do get this instead:

"Timestamp: 09/27/2013 10:49:16 AM
Error: NS_ERROR_XPC_NOT_ENOUGH_ARGS: Not enough arguments [nsIDOMWindow.postMessage]
Source File: http://10.14.213.69/js/get.js
Line: 28"

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Javascript postMessage Syntax Error DOM Exception in Web Worker Code dman777 <darin.hensley@gmail.com> - 2013-09-27 08:09 -0700
  Re: Javascript postMessage Syntax Error DOM Exception in Web Worker Code Martin Honnen <mahotrash@yahoo.de> - 2013-09-27 17:47 +0200
  Re: Javascript postMessage Syntax Error DOM Exception in Web Worker Code dman777 <darin.hensley@gmail.com> - 2013-09-27 08:52 -0700
    Re: Javascript postMessage Syntax Error DOM Exception in Web Worker Code Martin Honnen <mahotrash@yahoo.de> - 2013-09-27 18:57 +0200
  Re: Javascript postMessage Syntax Error DOM Exception in Web Worker Code dman777 <darin.hensley@gmail.com> - 2013-09-27 10:09 -0700
    Re: Javascript postMessage Syntax Error DOM Exception in Web Worker Code dman777 <darin.hensley@gmail.com> - 2013-09-27 10:57 -0700

csiph-web