From fbc352fccfead53a78f3fc356a0a9a984a696c12 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Wed, 11 May 2022 13:23:24 -0400 Subject: [PATCH] test: fixup done being called multiple times (#34175) --- spec-main/api-browser-window-spec.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spec-main/api-browser-window-spec.ts b/spec-main/api-browser-window-spec.ts index 94bdc956a5b68..1b5f4260b8489 100644 --- a/spec-main/api-browser-window-spec.ts +++ b/spec-main/api-browser-window-spec.ts @@ -3516,9 +3516,14 @@ describe('BrowserWindow module', () => { describe('beginFrameSubscription method', () => { it('does not crash when callback returns nothing', (done) => { const w = new BrowserWindow({ show: false }); + let called = false; w.loadFile(path.join(fixtures, 'api', 'frame-subscriber.html')); w.webContents.on('dom-ready', () => { w.webContents.beginFrameSubscription(function () { + // This callback might be called twice. + if (called) return; + called = true; + // Pending endFrameSubscription to next tick can reliably reproduce // a crash which happens when nothing is returned in the callback. setTimeout(() => {