Reputation: 7600
I am trying to create some global variables in a firefox extension. In my content folder, I have two javascript files:
1) Main JS file that holds the functions for the different events, etc
2) A file that stores only an object with the pieces of state I want to maintain. Also, I set the array EXPORTED_SYMBOLS.
I am having issues with the following line found in my main JS file:
Components.utils.import("resource:///globalVariables.js");
When it is at the top of the file, nothing seems to work. If I move it into the function where I need the variable, the rest of my code works, but the function with this line does nothing. Any advice that would help me with this problem would be great. Thanks
Upvotes: 2
Views: 2410
Reputation: 4682
Chances are resource:///globalVariables.js is not the right URI. Make sure you register it properly, and include the aliasname when you reference it.
Upvotes: 2