-
-
Notifications
You must be signed in to change notification settings - Fork 32k
timers: fixing API refs to use safe internal refs #2500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,20 @@ | ||||||||||||||
'use strict'; | ||||||||||||||
const common = require('../common'); | ||||||||||||||
const assert = require('assert'); | ||||||||||||||
|
||||||||||||||
// don't verify the globals for this test | ||||||||||||||
common.globalCheck = false; | ||||||||||||||
|
||||||||||||||
// try overriding global APIs to make sure | ||||||||||||||
// they're not relied on by the timers | ||||||||||||||
global.clearTimeout = assert.fail; | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should probably add everything here: Lines 171 to 176 in ec6e5c7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We could apply the fix to all API methods, but if they aren't being called, it seems like unnecessary extra code. |
||||||||||||||
|
||||||||||||||
// run timeouts/intervals through the paces | ||||||||||||||
const intv = setInterval(function() {}, 1); | ||||||||||||||
|
||||||||||||||
setTimeout(function() { | ||||||||||||||
clearInterval(intv); | ||||||||||||||
}, 100); | ||||||||||||||
|
||||||||||||||
setTimeout(function() {}, 2); | ||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been thinking about it and I think it would be best to only do this for the globals, so only
clearTimeout
in this patch. (Plus we also don't test active/{un}enroll and there's not a terribly good reason to.