Closed
Bug 1426886
Opened 6 years ago
Closed 6 years ago
Timer.jsm setTimeout doesn't check that aCallback is a function
Categories
(Toolkit :: General, defect)
Tracking
()
RESOLVED
FIXED
mozilla60
Tracking | Status | |
---|---|---|
firefox60 | --- | fixed |
People
(Reporter: WeirdAl, Assigned: WeirdAl)
Details
Attachments
(1 file, 1 obsolete file)
2.33 KB,
patch
|
mconley
:
review+
|
Details | Diff | Splinter Review |
I've been getting a really dumb, hard-to-trace error because somewhere in our company code, we passed in a non-function to Timer.jsm's setTimeout. CONSOLE: error [JavaScript Error: "TypeError: aCallback.apply is not a function" {file: "resource://gre/modules/Timer.jsm" line: 30}] I realize some want to get rid of it (bug 1357731), but in the meantime can we at least sanity-check our arguments so they don't blow up later? Patch attached but not tested...
Attachment #8938678 -
Flags: review?(dolske)
Updated•6 years ago
|
Attachment #8938678 -
Flags: review?(dolske) → review?(mconley)
Comment 1•6 years ago
|
||
Comment on attachment 8938678 [details] [diff] [review] Timer.jsm.diff Review of attachment 8938678 [details] [diff] [review]: ----------------------------------------------------------------- Thanks! r=me if we brace the one-liner. ::: toolkit/modules/Timer.jsm @@ +24,5 @@ > var gTimerTable = new Map(); // int -> nsITimer > > function _setTimeoutOrIsInterval(aCallback, aMilliseconds, aIsInterval, > aTarget, aArgs) { > + if (typeof aCallback !== "function") Could you please brace this one-liner? That seems to be the convention throughout the rest of the file.
Attachment #8938678 -
Flags: review?(mconley) → review+
Assignee | ||
Comment 2•6 years ago
|
||
I can - but I think I should also add an automated test somewhere... at the time I filed this bug, I was rather annoyed.
Comment 3•6 years ago
|
||
(In reply to Alex Vincent [:WeirdAl] from comment #2) > I can - but I think I should also add an automated test somewhere... at the > time I filed this bug, I was rather annoyed. Yes, that's a very good idea. toolkit/modules/tests/xpcshell/test_timer.js is the right place.
Assignee | ||
Comment 4•6 years ago
|
||
Assignee | ||
Comment 5•6 years ago
|
||
Comment on attachment 8945985 [details] [diff] [review] Timer.jsm should validate callback argument is a function with tests added and the braces corrected as desired
Attachment #8945985 -
Flags: review?(mconley)
Updated•6 years ago
|
Attachment #8938678 -
Attachment is obsolete: true
Comment 6•6 years ago
|
||
Comment on attachment 8945985 [details] [diff] [review] Timer.jsm should validate callback argument is a function Review of attachment 8945985 [details] [diff] [review]: ----------------------------------------------------------------- Looks great! Thanks for the tests!
Attachment #8945985 -
Flags: review?(mconley) → review+
Assignee | ||
Updated•6 years ago
|
Attachment #8945985 -
Flags: checkin?(mconley)
Assignee | ||
Comment 7•6 years ago
|
||
Comment on attachment 8945985 [details] [diff] [review] Timer.jsm should validate callback argument is a function I forgot, checkin-needed is still preferred.
Attachment #8945985 -
Flags: checkin?(mconley)
Assignee | ||
Updated•6 years ago
|
Keywords: checkin-needed
Pushed by btara@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/00ef102abbc6 Timer.jsm should validate callback argument is a function. r=mconley
Keywords: checkin-needed
Comment 9•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/00ef102abbc6
Status: NEW → RESOLVED
Closed: 6 years ago
status-firefox60:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
You need to log in
before you can comment on or make changes to this bug.
Description
•