Hi,
here is the js code. If you want me to produce an XPI with the actual dll...just let me know. I could send it to you as an email
is.onAsyncCall = function ()
{
try
{
is.component.asyncHttpReq();
}
catch(e)
{
is.IS_Log(' asyncHttpReq; ' + e + ' Error line: ' + e.lineNumber);
}
}
var tmp = null;
var theCallback= null;
var asyncHttpReq1 = null;
var funcType = ctypes.FunctionType(
ctypes.stdcall_abi,
ctypes.void_t,
[ctypes.jschar.ptr,
ctypes.int32_t,
ctypes.bool]);
var funcPtrType = funcType.ptr;
is.component = {
is_lib: null,
asyncHttpReq: null,
callback: null,
done: false,
unload: function()
{
try
{
if(this.is_lib)
{
this.is_lib.close();
}
}
catch(e)
{
is.IS_Log(' component unload; ' + e + ' Error line: ' + e.lineNumber);
}
},
load : function()
{
try
{
var fp = Components.classes["@
mozilla.org/file/directory_service;1"]
.createInstance(Components.interfaces.nsIProperties)
.get("ProfD", Components.interfaces.nsIFile);
fp.append("extensions");
fp.append(is.EXTENSION_ID);
fp.append("components");
fp.append("is.dll");
is.component.is_lib = ctypes.open(fp.path);
is.component.done = true;
}
catch(e)
{
is.IS_Log(' component load; ' + e + ' Error line: ' + e.lineNumber);
alert(' component load; ' + e + ' Error line: ' + e.lineNumber)
}
},
asyncHttpReq: function()
{
try
{
//tmp = this.asyncCallback;
tmp = another_asyncCallback;
theCallback = funcPtrType(tmp);
//this.asyncHttpReq = this.is_lib.declare("asyncHttpRequest",
asyncHttpReq1 = this.is_lib.declare("asyncHttpRequest",
ctypes.winapi_abi,
ctypes.void_t,
ctypes.jschar.ptr,
ctypes.jschar.ptr,
ctypes.jschar.ptr,
ctypes.jschar.ptr,
funcPtrType
);
asyncHttpReq1('get', '
https://www.google.com/', null, 'Accept: */*', theCallback);
}
catch(e)
{
is.IS_Log(e + ' Error line: ' + e.lineNumber);
}
},
asyncCallback: function(data, res, success)
{
alert('received');
alert(data.readString());
//alert('Success = ' + success + "\ncurl http ret = " + res + "\n response = " + data.readString());
}
}
function another_asyncCallback(data, res, success)
{
alert('testing...')
alert(data.readString());
}