I wonder if this happens with anyone else - because I tried on another
PC and same thing...

Anyhow, this is my workaround for the time being.  It's actually quite
neat because you can have the worker in the same file.  Tested to work
in IE7, Firefox 3 & Chrome.

// index.js
var _wp = google.gears.factory.create('beta.workerpool');
_wp.onmessage = function(a, b, msg) {
  alert('Received message: ' + msg.body);
}

function worker() {
        var _wp = google.gears.workerPool;
        _wp.onmessage = function(a, b, msg) {
                _wp.sendMessage('Got message from worker URL: ' + msg.body,
msg.sender);
        }
}

var _child = _wp.createWorker(worker.toString() + 'worker();');
_wp.sendMessage('test', _child);

Cheers

Chris

On Nov 18, 6:52 pm, Khookie <[EMAIL PROTECTED]> wrote:
> Hi
>
> Managed to narrow it down:
>
> It seems that createWorkerFromUrl does not work in Google Chrome - at
> least my Google Chrome anyhow.  Sample code below:
>
> var _wp = google.gears.factory.create('beta.workerpool');
> _wp.onmessage = function(a, b, msg) {
>   alert('Received message: ' + msg.body);}
>
> var _child = _wp.createWorkerFromUrl('worker.js');
> // var _child = _wp.createWorker("var _wp = google.gears.workerPool;
> _wp.onmessage = function(a, b, msg) { _wp.sendMessage('Got message: '
> + msg.body, msg.sender); }");
> _wp.sendMessage('test', _child);
>
> createWorker works fine.
>
> Cheers
>
> Chris
>
> On Nov 18, 9:18 am, Khookie <[EMAIL PROTECTED]> wrote:
>
> > Hi
>
> > Just wondering anyone has had big difficulties with debugging Gears
> > applications in Chrome?  Especially ones with workerpools.
>
> > I keep getting the below error in the Javascript Console on the line
> > which creates the worker (i.e. wp.createWorkerFromUrl).
>
> > Uncaught TypeError: Property 'onerror' of object [object global] is
> > not a function
>
> > and the funny thing was... I commented all the code in the worker file
> > out and it still came up with that error message.  The code works fine
> > in both IE & Firefox.
>
> > Chris

Reply via email to