Closed Bug 431978 Opened 16 years ago Closed 16 years ago

Don't pass strings to setTimeout

Categories

(Thunderbird :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 3

People

(Reporter: philor, Assigned: philor)

References

()

Details

Attachments

(1 file)

As pretty much every guide to either efficient or secure JavaScript says, setTimeout("foopy()", 0) is almost never what you want to do.
Depends on: 417354
Attached patch Fix v.1Splinter Review
Pretty straightforward, with just a little collateral cleanup in addressingWidgetOverlay.js, where the recursive setTimeout bits have been commented out since March 2002, well before we even got around to forking it, so I think it's quite safe to get rid of them. (I was hoping to get rid of the whole use of a setTimeout, but I was still able to reproduce bug 21280, in Windows only, by pegging the CPU with builds going in two other VMs at the same time.)
Attachment #319244 - Flags: review?(mkmelin+mozilla)
Comment on attachment 319244 [details] [diff] [review]
Fix v.1

Looks good, r=mkmelin

In addressingWidgetOverlay.js you could take the opportunity to add a space between the // comments and move the else if to one row.
Attachment #319244 - Flags: review?(mkmelin+mozilla) → review+
Good idea, thanks. De-nitted and landed.

mail/base/content/searchBar.js 1.47
mail/components/migration/content/migration.js 1.11
mail/components/compose/content/addressingWidgetOverlay.js 1.15
mail/components/compose/content/MsgComposeCommands.js 1.134
mail/components/preferences/downloadactions.js 1.7
mail/components/addrbook/content/abCommon.js 1.30
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
philor:
One string left in mailnews/
http://mxr.mozilla.org/comm-central/source/mailnews/addrbook/content/abMailListDialog.js#504

I'll fix it in SeaMonkey Bug 571517 unless you beat me to it.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: