Today is my first day working with Firefox extensions.
I basically do an extension that will be used on the internal network to check the web server for new notifications.
I used the wizard on the mozilla page to make a skeleton extension, and then basically edited overlay.js with some ajax code.
I use the "load" event listener to call setTimeout for my ajax call, which then iterates through setTimeouts.
The problem is that the "load" event listener runs in every new browser window. I just want one global timer to work for this.
Any ideas?
Update:
I found this: https://developer.mozilla.org/en/JavaScript_code_modules/Using which seems like what I would like. The problem is that I cannot figure out how to import a jsm file. What is a directory structure?
Update:
When trying this:
chrome.manifest
content spt chrome/content/ skin spt classic/1.0 chrome/skin/ locale spt en-US chrome/locale/en-US/ overlay chrome://browser/content/browser.xul chrome://spt/content/ff-overlay.xul style chrome://global/content/customizeToolbar.xul chrome://spt/skin/overlay.css resource mycontent chrome/content/
The first 5 lines of chrome /content/overlay.js
try{ Components.utils.import("resource://spt/mycontent/ajax.jsm"); }catch(err){ alert(err); }
I get this error:
[Exception ... "Returned component failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXPCComponents_Utils.import]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: chrome: //slay/content/ 2 ": no]
Or if I remove the resource alias from chrome.manifest and use it at the beginning of overlay.js
try{ Components.utils.import("chrome://spt/content/ajax.jsm"); }catch(err){ alert(err); }
I get this error:
[Exception ... "Returned component failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXPCComponents_Utils.import]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: chrome: //spt/content/lay 3 ": no]
source share