fix remote setInterval flake (#12263)
This commit is contained in:
parent
e7181eb89c
commit
9ed9885c8d
1 changed files with 5 additions and 1 deletions
|
@ -184,11 +184,15 @@ describe('node feature', () => {
|
||||||
describe('setInterval called under Chromium event loop in browser process', () => {
|
describe('setInterval called under Chromium event loop in browser process', () => {
|
||||||
it('can be scheduled in time', (done) => {
|
it('can be scheduled in time', (done) => {
|
||||||
let interval = null
|
let interval = null
|
||||||
|
let clearing = false
|
||||||
const clear = () => {
|
const clear = () => {
|
||||||
if (interval === null) {
|
if (interval === null || clearing) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// interval might trigger while clearing (remote is slow sometimes)
|
||||||
|
clearing = true
|
||||||
remote.getGlobal('clearInterval')(interval)
|
remote.getGlobal('clearInterval')(interval)
|
||||||
|
clearing = false
|
||||||
interval = null
|
interval = null
|
||||||
done()
|
done()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue