bug fixing
Sunday, January 22nd, 2012 04:16 amI fixed a bug in my Firefox add-on today. It was trickier to fix than I had expected. It seems that you get a new instance of the add-on object for each browser window that is opened. In any case, the event observers that you set up in the add-on code get called for each window, so any logic which is in the observe() function may end up getting executed multiple times for a single event.
When I try to understand some code examples, I feel like I don't know much JavaScript at all. Javascript seemed much simpler when I first learned it. Now it seems full of syntax that I'm not familiar with. Some day I hope to understand this kind of stuff.
The only simple way I could think of dealing with my add-on's problem, was to write out a user preference value and use it like a global variable which all instances of the add-on could check, to determine whether or not to execute the code in the observe() function.
When I try to understand some code examples, I feel like I don't know much JavaScript at all. Javascript seemed much simpler when I first learned it. Now it seems full of syntax that I'm not familiar with. Some day I hope to understand this kind of stuff.
The only simple way I could think of dealing with my add-on's problem, was to write out a user preference value and use it like a global variable which all instances of the add-on could check, to determine whether or not to execute the code in the observe() function.