nsIFactory

This interface is a class factory that allows for the creation of nsISupports derived classes without specifying a concrete class type.
Inherits from: nsISupports Last changed in Gecko 0.9.5

Method overview

void createInstance(in nsISupports aOuter, in nsIIDRef iid, [retval, iid_is(iid)] out nsQIResult result);
void lockFactory(in PRBool lock);

Methods

createInstance()

Creates an instance of the class associated with this factory. Unlike getService, this returns a new instance each time it is called. (See also nsIComponentManager.createInstance.)

void createInstance(
  in nsISupports aOuter,
  in nsIIDRef iid,
  [retval, iid_is(iid)] out nsQIResult result
);
Parameters
aOuter
Pointer to a component that wishes to be aggregated in the resulting instance. This can be nsnull if no aggregation is requested.
iid
The IID of the interface being requested in the component which is being currently created.
result
Pointer to the newly created instance, if successful.
Exceptions thrown
NS_ERROR_NO_INTERFACE
Indicates that the requested interface is not supported.
NS_ERROR_NO_AGGREGATION
Indicates that aggregation is not supported.

lockFactory()

This method provides the client a way to keep the component in memory until it is finished with it.

Gecko 1.7 note
As of Gecko 1.7, this method is unused. Most implementations do nothing interesting with this method. It exists primarily for binary compatibility with Microsoft COM's IClassFactory interface.

void lockFactory(
  in PRBool lock
);
Parameters
lock
true to lock the factory, and false to unlock the factory.

Remarks

On WIN32 systems, nsIFactory is ABI-compatible with Microsoft COM's IClassFactory interface.

This interface was frozen for Gecko 0.9.5. See bug 99144 for details. From Gecko 2.0 interfaces are no longer frozen.

See also

Document Tags and Contributors

 Last updated by: Jonathan_Watt,