firefoxfirefox-addonxulfirefox-addon-sdk

Firefox Extension, adding Button to Navigation Toolbar (Similar to LiveHeaders and FireBug)


I'm trying to get a button to appear in the "Customize toolbar" list on Firefox (based on this tutorial (Custom_toolbar_button)).

Customize toolbar
(source: iforce.co.nz)

In theory, to customize this section of the browser.

Buttons
(source: iforce.co.nz)

Here is my button.xul file

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css"
  href="chrome://helloworld/content/button.css" ?>
<!DOCTYPE overlay>
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="helloworld-overlay">
    <script type="application/javascript" src="chrome://helloworld/content/button.js" />
    <!-- Firefox -->
    <toolbarpalette id="BrowserToolbarPalette">
        <toolbarbutton id="custom-button-1" />
    </toolbarpalette>
    <!-- button details -->
    <toolbarbutton id="custom-button-1" label="Custom" tooltiptext="My custom toolbar button" oncommand="CustomButton[1]()" class="toolbarbutton-1 chromeclass-toolbar-additional custombutton" />
</overlay>

And chrome.manifest

content helloworld chrome/
style chrome://global/content/customizeToolbar.xul chrome://helloworld/content/button.css

# Firefox
overlay chrome://browser/content/browser.xul chrome://helloworld/content/button.xul

I've tested my button.xul on Xul Explorer, with good results (it compiles fine).

XUL explorer Custom Button
(source: iforce.co.nz)

For some reason, I am just unable to add this button where I would like for Firefox.


Solution

  • I figured out how to add the necessary Button via the main.js created during cfx init (docs with the extension being produced by the command cfx xps.

    Additionally, I was talking to a developer in #developer on the mozilla IRC, and he stated adding the to the Nav Bar programmatically will soon become redundant because the next release of Firefox (version 29) will provide functionality to add information the Navigation Toolbar using xul.