What happens when I call setTimeout in a firefox extension? Is there ever a condition in which multiple callbacks can run simultaneously?
My firefox extension contains an array of URLs that I want to take screenshots of. My extension opens 5 tabs, and sets the URLs of these tabs to be the first 5 URLs in the array. Once a page finishes loading in tab N, I want to wait 30 seconds, take a screenshot, and then pop the next URL off the array and load it in tab N. The process repeats itself until the list of URLs is empty.
How can I be sure that each URL is processed exactly once? If I was writing this in java I would just synchronize all accesses to my URL list. How can I achieve this in a Firefox extension?