XMLHttpRequest fails in observer method

Posted by Michael on Stack Overflow See other posts from Stack Overflow or by Michael
Published on 2010-05-09T01:40:02Z Indexed on 2010/05/09 1:48 UTC
Read the original article Hit count: 343

Filed under:
|
|
|

I'm developing a Firefox extension and this code belongs to javascript module.

var ajax = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance();
ajax.open('GET', "http://www.google.com", true);
ajax.onload = function ()
{
    Reader.log("Got News");
};
ajax.onerror = function ()
{
    Reader.log("Got Error");
};
ajax.send(null);

This small code always fails (onerror) if calling from observe method invoked by preference "@mozilla.org/preferences-service;1"

Anyone knows how to make this work in observe method?

© Stack Overflow or respective owner

Related posts about firefox

Related posts about extension