Its possible to inherit methods from xpcom component ?

My example::

I want extend
http://lxr.mozilla.org/seamonkey/source/rdf/base/idl/nsIRDFResource.idl
(add two attributes). I created IDL file:

#include "nsISupports.idl"
#include "nsIRDFResource.idl"

[scriptable, uuid(aaa22684-6aa6-4a7e-bb1b-35331f3e71cd)]
interface nsILdapAuth : nsIRDFResource
{
  attribute string bind_dn;
  attribute string bind_pw;
};


and javascript component:

const NS_LDAPRESOURCEFACTORY_CONTRACTID =
 '@mozilla.org/rdf/resource-factory;1?name=ldap';
const NS_LDAPRESOURCEFACTORY_CID =
  Components.ID('{aaa22684-6aa6-4a7e-bb1b-35331f3e71cd}');

function nsLDAPResource() {}

nsLDAPResource.prototype = {

    //Bind username and password..
    kUserDn: "",
    kPass: "",


    Init: function(aURI)
    {
      kUser = "i";
    },

    get bind_dn()
    {
      return this.kUserDn;
    },

    set bind_dn( val )
    {
      this.kUserDn = val;
    },

    get bind_pw()
    {
      return this.kPass;
    },

    set bind_pw(val)
    {
      this.kPass = val;
    },

    // since we implement multiple interfaces, we have to provide QI
    //
    QueryInterface: function(iid) {
      if (iid.equals(Components.interfaces.nsISupports) ||
          iid.equals(Components.interfaces.nsIRDFResource) ||
          iid.equals(Components.interfaces.nsILdapAuth)
          )
          return this;

      Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
      return null;
    }
}


-----------------

var rdf = Components.classes["@mozilla.org/rdf/resource-factory;1?name=ldap"].createInstance(Components.interfaces.nsIRDFResource);
rdf.GetDelegate("aaa",Components.interfaces.nsISupportsArray);

I get this exception:

Javascript component does not have a method named: "GetDelegate" when calling method: [nsIRDFResource::GetDelegate]" nsresult "0x80570030" (NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED)

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

Reply via email to