Hi all,

I had once written a firefoix add-on that worked well in FF 2, but
makes some problems in FF 3, which I'm not sure what they are.


1) When cliking a certain button, the add-on inserts an image at
certain places of the document via

var newimg = doc.createElement("img");
newimg.alt="My Alt Text";
newimg.src="chrome://myaddon/skin/ok.png";
newimg.style.height="1em";
newimg.style.border="none";
someTag.appendChild(newimg);

This worked in FF2, but now (FF 3.0.3) only the alternative text ("My
Alt Text") is displayed.
I first thought that somehow the relation between relative package
urls and chrome urls might have changed, thus making the image
unreadable.
However, doing a right click - copy image url and pasting the url into
a new browser tab *does* display the correct image.
What am I missing / what must I do to actually display the image
instead of the alt text?


2) Whether a certain button is enabled or not should depend on the url
of the currently visible page.
To achieve this I had done the following (during initialization)

getBrowser().tabContainer.addEventListener("TabSelect", function(e)
{ MyAddOn.CheckDisable(); }, false);
window.addEventListener("load", function(e) { MyAddOn.CheckDisable
(); }, true);

where the method CheckDisable is given by
CheckDisable: function() {
var Browser = getBrowser().selectedBrowser;
var url = Browser.currentURI.spec;
var wantdisabled = (* some bool depending on url *);
var check = document.getElementById("cmd_MyCmd");
if (wantdisabled != check.hasAttribute("disabled")) {
if (!wantdisabled) {
check.removeAttribute("disabled");
} else {
check.setAttribute("disabled",true);
}
}
}


It appears to me that this works only halfway (and in contrast to the
first problem I'm not 100% sure if this did work in FF 2, though I'm
sure to more or less have learned that idiom from some now obsolete
tutorial on add-ons):
When switching between several tabs, the CheckDisable method does what
it is supposed to do, depending on the url displayed with the tab
brought to foreground.
When working without tabs (i.e. with only one tab) or actually
changing the foreground ulr (by typing, back, forward, history,
favorite, home, whatever) the check is not performed.
What's wrong here?


Thanks in advance
hagman