Hi,

I'm writing an XPCOM component in C++. It's using js callbacks defined
as follow in an idl file:

[scriptable, uuid(...)]
interface JSCallback : nsISupports
{
  boolean call();
};

In the C++ code, I'm using them as follow:

nsCOMPtr<JSCallback> foundcb;
...
foundcb->Call(&ret);

I can successfully trig the callbacks from the C++ compononent, when
calling it from the main thread.

My problem is that I also have to trig those callbacks in other
threads, created by a third party dll that I'm also using
successfully. Those calls end up in the following js error:

Error: [Exception... "'Permission denied to get property Function.__parent__' 
when calling method: [JSCallback::call]"  nsresult: "0x8057001e 
(NS_ERROR_XPC_JS_THREW_STRING)"  location: "<unknown>"  data: no]

The callback objects are proxified in the main thread as follow:

foundproxy->GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
                              JSCallback::GetIID(),
                              foundcb,
                              NS_PROXY_SYNC|NS_PROXY_ALWAYS,
                              getter_AddRefs(foundcbproxy));

I'm then using the callback like that:

foundcbproxy->Call(&ret);

Any idea of the source of the error ?

Thanks a lot for your reply.
-AJ

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to