Skip to content

Commit

Permalink
test: fixup done being called multiple times (#34187)
Browse files Browse the repository at this point in the history
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
  • Loading branch information
trop[bot] and jkleinsc committed May 13, 2022
1 parent bcca5c5 commit 7bae935
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spec-main/api-browser-window-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3509,9 +3509,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(() => {
Expand Down

0 comments on commit 7bae935

Please sign in to comment.