开发者

what is the right way of loading javascript module in the xbl/ xul file?

I am developing an extension in Firefox. I want to load a simple javascript module to my xbl file. I have followed the instructions in here but I don't get any results. In fact when I call the method inside the handler it doesn't exe开发者_Go百科cute.

This is my file structure for extensions

-Magic/chrome/urltooltip/content/(browse.xbl, options.xul, browser.css)

-Magic/modules/(test.js)

I have registered resource in chrome manifest: resource app chrome://modules/test.js or resource gre chrome://modules/test.js it doesn't work.

in the xbl file I imported the file like this:

Components.utils.import(resource://app|gre/modules/test.js)

I don't know what else to do.


Use something like this:

<?xml version="1.0"?>

<window xmlns:html="http://www.w3.org/1999/xhtml"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <script src="foo.js"></script>

  <script>
    <[CDATA[
      function bar() {}
    ]]>
  </script>

  <caption label="Hello World"/>

</window>  
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜