i am only focusing on alert() at the moment:
http://pastebin.mozilla.org/693218
this works if the alert() calls in the HTML of the loaded webpage are
initiated after the DOM of the webpage is loaded. However, alerts that
are called during the building of the DOM, still use the built-in alert
() call which hasn't been overridden yet like in the case of this
HTML:
http://pastebin.mozilla.org/693217
My aim is to disable alert(), prompt() and so on for a certain tab
only, but i can't seem to disable alert() at the right moment for the
content that is loading in a tab.
It has been suggested that i overwrite commonDialog.xul, but that
would probably disable alert for all tabs in the browser and that
wouldn't be cool.
Some have suggested looking into the Mozmill test app which deals with
UI testing automation (including automatically closing alert windows),
but it does not provide what i am looking for.
Maybe there are events such as DOMWillBeGeneratedShortly, after which
DOMContentLoaded gets called. I would probably need to do my alert
disabling after that 1st event and before the 2nd, because apparently
the runtime alerts that are bothering me happen just before the 2nd
event.
Is there such a hypothetical event? I haven't found any good resource
for finding out the event chains that are fired during the loading of
a tab.
How about executing your code in your windowLoaded() event handler instead
of DOMLoaded event handler()?
Another idea is to implement your own nsIPromptService XPCOM component, and
install your component as the default instead of Gecko's. You can then
delegate some call alert() calls to the Gecko implementation and eat others,
as you like.
Eric
>
> Another idea is to implement your own nsIPromptService XPCOM component, and
> install your component as the default instead of Gecko's. You can then
> delegate some call alert() calls to the Gecko implementation and eat others,
> as you like.
that seems like a great idea. that would give me the most flexible
system for this. can you point me to a resource/example/tutorial that
talks me through such a process?