views:

41

answers:

1

Hi,

I am writing Firefox extension which would be compatible with Firefox's 3.0 to 3.6 versions.

I am using nsIDOMNSHTMLElement interface pointer for setting inner text of html element. I am getting nsIDOMNSHTMLElement interface pointer by calling QI on nsIDOMElement

But IID of nsIDOMNSHTMLElement changes from Firefox's 3.0 to 3.6 versions as gecko version changes.

How can I use nsIDOMNSHTMLElement interface?

How can I compile my extension so that It will work with above mentioned Firefox versions.

Thanks, Vaibhav.

+1  A: 

https://developer.mozilla.org/en/Working_with_Multiple_Versions_of_Interfaces

Basically, when building your component, prepare all versions of the changed interfaces (e.g. from 3.0 and 3.6) and their IIDs, then in code first try to QI by the newer IID (and use the newer class declaration for the interface), and if that fails, QI using the old IID (and use the old declaration of the interface).

P.S. And I do recommend you to stop wasting your time and write in JS, whenever possible.

Nickolay