John Bandhauer wrote:
'instanceof' is not really a shortcut, it is just another way of producing the same state. The one important difference between 'instanceof' and 'QueryInterface' in this context is that 'instanceof' will simply return true or false. But, 'QueryInterface' will actually throw a JavaScript exception if the underlying object does not support the given interface.

John.


Thanks for this fine answer John. So to get the 'QueryInterface' checking ability, I just have to do:

if(!(rsc instanceof Components.interfaces.nsIRDFLiteral) throw 'NS_ERROR_XPC_INTERFACE_NOT_FROM_NSISUPPORTS';

Is this eeror code correct?

Daniel




Reply via email to