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