I’m trying to override an XPCOM contract using a Javascript-based Firefox extension. This is normally pretty painless, but the specific XPCOM contract I’m trying to override has a single method that is marked “noscript”. I don’t actually need to change the implementation of that “noscript” method – I only want to change one method, which is not marked as “noscript”. Given that I don’t need to change the “noscript” method’s behavior in any way, is there any way that I can change the behavior (using Javascript) of a scriptable method of a scriptable XPCOM interface, when that interface has one other method that is marked “noscript”?
Some working code for overriding an XPCOM contract with a Javascript implementation is at https://github.com/hlandau/nczilla . This code is overriding the @mozilla.org/security/certoverride;1 contract, for which all the methods are scriptable. I’m trying to find a way to do something similar for a contract that has one unscriptable method (although the method I want to replace is scriptable).
Actually, I’d also be interested in knowledge about overriding an XPCOM contract with a C++ implementation. I imagine this would fix the specific problem I’m having, I just can’t find any current example code for such an override.