darkoshi: (Default)
I 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.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

May 2026

S M T W T F S
      12
3456789
10111213141516
17181920212223
24252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Wednesday, May 13th, 2026 04:46 pm
Powered by Dreamwidth Studios