[Webkit-unassigned] [Bug 58191] Use console.log() instead of alert() in unload handlers in tests

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jun 14 13:29:54 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=58191





--- Comment #24 from Sreeram Ramachandran <sreeram at chromium.org>  2011-06-14 13:29:54 PST ---
(In reply to comment #23)
> (From update of attachment 97157 [details])
> Can we instead make it so that an alert call during an unload handler logs an error to the console? That would make it so we don't need to modify these tests and would have the added benefit of being more friendly to web developers who try to use alert in unload handlers for debugging.

It's probably not very hard, but certainly not trivial, as you pointed out yourself in comment 13.

More importantly, I don't see the benefit. Developers will still have to open the console manually to see the messages. If they are going to do that, why not use console.log() instead?

In general, I think we should encourage developers to use console.log() over alert():
1. It will be consistent across the various webkit platforms. Otherwise, they'll see a console message in Chrome, but a dialog in Safari.
2. It can be used in places where alert() would mess up what you are trying to observe, for example in onblur().
3. It is non-flooding. As a web developer, I've occasionally thrown an alert() in the middle of a loop, only to regret it soon after. If a console message is repeated, the console helpfully adds a repeat count instead of actually repeating the message.
4. Firefox also seems keen on killing alerts in unload (see https://bugzilla.mozilla.org/show_bug.cgi?id=391834). There's no guarantee that they will shim those alerts through to the console.

I think modifying these tests is not a big deal. In the two months since I uploaded the first patch, no new instances of alert() in unload handlers (beforeunload, unload, pagehide) have been introduced. Besides, unless we make the console message exactly the same as the alert ("ALERT: message"), test expectations will still have to be modified.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list