I'm having in my IDL file:

===================================================
#include "nsISupports.idl"
[scriptable, uuid(....)]
interface nsIXXXException : nsISupports
{
 readonly attribute wstring message;
};

[scriptable, uuid(.....)]
interface nsIXXX : nsISupports
{
 void logIn() raises(nsIXXXException);
};
===================================================

I have nsIXXXException implemented in JavaScript, but it Factory is not registered (I don't want to allow create instances of this component outside my main component):
===================================================
function XXXException( message )
{
this._m = message;
return this;
}


XXXException.prototype = {
_m: '',
get message() { return this._m; },


 QueryInterface: function (iid)
 {
   if( ! iid.equals( Components.interfaces.nsIXXXException ) &&
       ! iid.equals( Components.interfaces.nsISupports ) )
     throw Components.results.NS_ERROR_NO_INTERFACE;
   return this;
 }
};
===================================================

My main component (which is have registered ContractID, etc), create and throw exception:
===================================================
....
throw new XXXException( 'Bad thing failed' );
....
===================================================


  And component's client catch `NS_ERROR_XPC_JS_THREW_JS_OBJECT' exception!

How could I convert JavaScript object into interface (like when I pass JS object to addEventListener() call) without calling Components.classes[CID].createInstance()?

Lev Serebryakov
Programmer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


_______________________________________________ Mozilla-xpcom mailing list [email protected] http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to