DomContentLoaded fires repeatedly - Mozilla

This is a discussion on DomContentLoaded fires repeatedly - Mozilla ; Hello --
I'm working on a Firefox extension that will manipulate pages when
they are loaded. I'm watching for the DOMContentLoaded event, but it
seems to fire repeatedly. When I am not connected to the internet,
Firsfox displays the standard ...

DomContentLoaded fires repeatedly

Hello --

I'm working on a Firefox extension that will manipulate pages when
they are loaded. I'm watching for the DOMContentLoaded event, but it
seems to fire repeatedly. When I am not connected to the internet,
Firsfox displays the standard "Server not found" message with a single
"HELLO WORLD" inserted at the end, as should happen. However, when I
am connected to the internet, the browswr freezs on page load, and,
after a time, unfreezes and has thousands of "HELLO WORLD"s at the
bottom of the page. The only explanation I can think of is that
DOMContentLoaded is fired many times.

Any solutions, advice, or pointers to helpful articles/documentation
would be much appreciated.

Re: DomContentLoaded fires repeatedly

Why do you add another event listener to a previous declared one? of
course that will iterate continuously while all resources are loaded.
Why not set the DOMContentLoaded event listener directly on the
window? or maybe I don't understand what you are trying to achieve
here, it seems a race condition you created.

Re: DomContentLoaded fires repeatedly

On Sep 24, 9:47*am, 0x000000 wrote:
> Why do you add another event listener to a previous declared one? of
> course that will iterate continuously while all resources are loaded.
> Why not set the DOMContentLoaded event listener directly on the
> window? or maybe I don't understand what you are trying to achieve
> here, it seems a race condition you created.

The symptoms (repeated execution of onPageLoad) persist when I change
the code to attach the DOMContentLoaded event to the window: