Benjamin D. Smedberg wrote:

Jonathan Watt wrote:

Is it possible for the native C++ code to detect that it doesn't have a genuine nsIFoo so it can enforce the requirement that objects passed to it be genuine nsIFoo objects.


There is no such thing as a "genuine nsIFoo object"... anybody is allowed to implement an interface. Do you need to do this for security reasons? If so, define a non-scriptable interface (or a pseudo-interface) and make your C++ component QI to that. This is how the mozilla DOM code prevents untrusted script from implementing DOM nodes (it QIs each DOM node passed in to nsIContent).

--BDS

Actually it is for something similar. I want to prevent JS code from passing SVG objects that are not implemented by the C++ SVG code to functions on SVG objects that expect one. Specifically, as shown in bug 164049, I want to make sure that the underlying implementation of the nsISVGMatrix passed to nsSVGTransform::SetMatrix() is an nsSVGMatrix object. Would you be able to point me in the direction of the relevant DOM code?


Thanks Benjamin.

Jonathan
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to