Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
test: fixup done being called multiple times (electron#34175)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkleinsc authored and khalwa committed Feb 22, 2023
1 parent 50337dd commit fbc352f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spec-main/api-browser-window-spec.ts
Expand Up @@ -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(() => {
Expand Down

0 comments on commit fbc352f

Please sign in to comment.