function createBookmarkItem() {
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/
there.is.only.xul";
var anitem = document.createElementNS(XUL_NS, "toolbarbutton");
anitem.setAttribute("id", "Testing-Doit-Button2");
anitem.setAttribute("class", "toolbarbutton-1 chromeclass-toolbar-
additional pagerank");
anitem.setAttribute("label", "PageRank");
anitem.setAttribute("tooltiptext", "Do it!");
anitem.setAttribute("oncommand", "testing_doit();");
return anitem;
}
function placeBookmarkItem() {
var bar = document.getElementById("nav-bar");
var newitem = createBookmarkItem();
bar.appendChild(newitem);
}
placeBookmarkItem();
...adds a button with "bookmark-item pagerank" instead of
"toolbarbutton-1 chromeclass-toolbar-additional pagerank" as class to
PersonalToolbar instead of nav-bar!
How to solve this problem?
Now, it works! In the Javascript Shell, typing a function with the
same name as an other function in button.js and hiting enter, even if
they have different behaviors, will call the function in button.js
By the way, to use the Javascript Shell the way I used, you have to
install Extension Developer's Extension, then go Firefox -> Tools ->
ExtensionDeveloper -> Javascript Shell -> enumerateWindows() ->
chrome://browser/content/browser.xul