开发者

FireFox addon making toolbar icons disappear

I just completed mine first FF add-on . But after install it making the existing toolbar icons to disappear.

This is how mine chrome.manifest file looks like.

cont开发者_StackOverflow社区ent myext content/ 
overlay chrome://browser/content/browser.xul    chrome://myext/content/overlay.xul
locale  myext   en-US   locale/en-US/
skin    myext   classic/1.0 skin/
style       chrome://browser/content/browser.xul chrome://myext/skin/overlay.css
style chrome://global/content/customizeToolbar.xul chrome://myext/skin/overlay.css

Any ideas why this happening ?

Let me know if i need to post contents of more files.

Thanks

Edit: overlay.xul >

<?xml version="1.0"?> 
<?xml-stylesheet href="chrome://myext/skin/overlay.css" type="text/css"?> 
<!DOCTYPE overlay SYSTEM "chrome://myext/locale/overlay.dtd"> 
<overlay id="myext-overlay" 
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 

    <script src="loader.js"/>
    <script src='jquery.js'/>
    <script src="overlay.js"/>
    <script src="jquery.cookie.js"/>
    <script src="Jquery-ui.js"/>
    <script src="json2.js"/>
    <script src="script.js"/>


    <statusbar id="status-bar">
      <statusbarpanel role="button"
                        onmouseup="KH.bind_btn_click()"
                        tooltiptext="myext">
            <image src="chrome://myext/skin/icon.png" />
        </statusbarpanel>
    </statusbar>

</overlay> 

Dir structure >

/content
    overlay.xul
    [otehr js files]
/locale
/skin
/chrome/manifest
/install.rdf


Some of your javascript files are breaking Firefox.

The namespace on Firefox addons are global, meaning that if you use the name of something that already exists it will cause conflicts. Here is a blog post about Global Namespace polution.

Here you may find a simple article to create namespaces for you addon.


If your scripts attempt to access the DOM before the load event fires then this will trigger XBL binding on the affected nodes before overlay loading has finished. In particular when toolbar XBL binds it attempts to restore the custom toolbar configuration however for this to work all the overlays need to have been loaded so that the buttons are all available in the palette. There will be a workaround in Firefox 4 in the specific case of the toolbar but in general you should still avoid accessing the DOM before the load event.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜