2
votes

I am closely following the tutorial here as I attempt to create a Firefox extension. I have the following tree for my extension:

backtosearch
  +-chrome
    +-content
      backtosearch.xul
  +-chrome.manifest
  +-install.rdf

I have created a testing profile for FF called "Extension Testing" and have added a file to the profile extensions folder "[email protected]" containing absolute path to the extension folder. I have reloaded the browser chrome using the extension development extension and restarted the browser - but I see no new button.

I have simplified the tutorial (as I only require one button), and my .xul contains only that. My chrome.manifest file contains:

content backtosearch chrome/content/
overlay chrome://browser/content/browser.xul chrome://backtosearch/content/backtosearch.xul

The extension is not showing under view -> toolbars or tools -> addons

Thanks for any help

install.rdf

<?xml version="1.0"?>

<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:em="http://www.mozilla.org/2004/em-rdf#">

    <Description about="urn:mozilla:install-manifest">

        <!-- Required Items -->
        <em:id>[email protected]</em:id>
        <em:name>Back To Search</em:name>
        <em:version>1.0</em:version>

        <em:targetApplication>
            <Description>
                <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
                <em:minVersion>1.5</em:minVersion>
                <em:maxVersion>3.5.*</em:maxVersion>
            </Description>
        </em:targetApplication>

        <!-- Optional Items -->
        <em:creator>Dylan Lloyd</em:creator>
        <em:description>Adds options to return to your last search immediately.</em:description>
        <em:homepageURL>http://www.getyourkeywords.com/</em:homepageURL>

    </Description>
</RDF>

[email protected]

C:\Users\Dylan\Desktop\backtosearch\
3
Is the extension showing up in Tools->Add-ons? - sdwilsh
interestingly, i tried uninstalling the "tuttoolbar", placing the files on my desktop and creating a "pointer" file to it like i had been for mine. it didn't work either. - Nona Urbiz
If you can't this sorted with the help already provided, zip the files into an xpi file, upload it somewhere and we'll have a look at it. - Tim

3 Answers

2
votes

Hey I found out in moziila own documentation the mistake on this hello world.

You can read on: https://github.com/oschrenk/firefox-extension

I had written

<RDF xmlns="http://www.w3.org/1999/02/22-RDF-syntax-ns#"
     xmlns:em="http://www.mozilla.org/2004/em-RDF#">
    <Description about="urn:mozilla:install-manifest">

as the root element, but it needs to be all lowercase

<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:em="http://www.mozilla.org/2004/em-rdf#">
    <Description about="urn:mozilla:install-manifest">

Just update the install.rdf =)

1
votes

From your description it's not clear what the problem is. The most likely cause, as sdwilsh noted is that the Extension didn't get registered. If this is the case, the extension will not appear in Tools -> Addons.

You can try to set extensions.logging.enable pref to true to help debugging. Maybe try installing a helloworld extension first?

Possible causes:

  • You didn't use the correct name for the "link" file (must match the extension ID).
  • The "link" file contents is invalid (the path format is OS-native). In your case the path should end with "backtosearch"
  • Incorrect install.rdf. You can check it at least to be valid XML by opening it in Firefox (possibly renaming to .xml first) -- if the yellow screen opens, its invalid.
  • Installed in the wrong profile or didn't really restart Firefox.

If the extension is registered, try opening chrome://backtosearch/content/backtosearch.xul in Firefox (by copying that to the Location bar) -- if any errors appear, you should fix them. If the file loads successfully (may be empty), there's a problem with your overlay's contents, which is hard to debug without seeing it. Perhaps start with an overlay that's known to work?

0
votes

Try running it through Mozilla's Add-On Validation page. It might just tell you what the error is. If it is a javascript error, it will tell you for sure.

Now, I had the same problem - when I loaded my addon, my toolbar didn't appear, and even though the addon showed in "Tools > Addons", when I clicked on the "options" button, everything froze.

Turned out, there were several errors.

  • The optionsurl in my install.rdf had "cchrome" instead of "chrome".
  • In my main .js file, I forgot a ";" at the end of a line with a var assignment.
  • In my xul file, I did not leave a space: label="string"tooltip="string" between the two property assignments.
    • I had a hanging </toolbarbutton> from where I copied one line to the next. This is what really caused the problem. In the code file, the line was very long, and I never saw that part!

The combination was total failure, even though it passed fine in the Mozilla Validator. The Validator, in my opinion should have caught the cchrome thing. It would have caught the javascript error.

Anyway, I tell you that in case such might be YOUR problem.