<h3 dir="auto">Preflight Checklist</h3>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the <a href="https://github.com/electron/electron/blob/master/CONTRIBUTING.md">Contributing Guidelines</a> for this project.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow the <a href="https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md">Code of Conduct</a> that this project adheres to.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the issue tracker for an issue that matches the one I want to file, without success.</li>
</ul>
<h3 dir="auto">Issue Details</h3>
<ul dir="auto">
<li><strong>Electron Version:</strong>
<ul dir="auto">
<li>v12.0.0-beta.21</li>
</ul>
</li>
<li><strong>Operating System:</strong>
<ul dir="auto">
<li>Ubuntu 20.04</li>
</ul>
</li>
<li><strong>Last Known Working Electron version:</strong>
<ul dir="auto">
<li>v11.2.3 (the same provided example works most recent v11 release, tested!)</li>
</ul>
</li>
</ul>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Expecting <code class="notranslate">browserWindow.capturePage()</code> to return a promise that resolves to captured image</p>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">The function call will at some point result an uncaught promise exception. Currently it seems it's random and about a 5% chance of this happening.</p>
<h3 dir="auto">To Reproduce</h3>
<p dir="auto">Minimal example is a loop calling <code class="notranslate">browserWindow.capturePage()</code> every 1 second until eventually it fails. On my machine it will fail within a minute and result in the error.<br>
I tried with the new <code class="notranslate">@electron/remote</code> and also with the old <code class="notranslate">electron.remote</code>. The example is using the new remote module as it will result in an error whereas the old <code class="notranslate">electron.remote</code> will not result an exception, but instead the promise <strong>will never resolve or reject</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="git clone https://github.com/ozooner/electron-capture-page.git
npm install
npm start"><pre class="notranslate"><code class="notranslate">git clone https://github.com/ozooner/electron-capture-page.git
npm install
npm start
</code></pre></div>
<h3 dir="auto">Screenshots</h3>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/2709373/107247085-c34d9180-69e5-11eb-83d3-344a77387cde.png"><img src="https://user-images.githubusercontent.com/2709373/107247085-c34d9180-69e5-11eb-83d3-344a77387cde.png" alt="image" style="max-width: 100%;"></a></p>
<h3 dir="auto">Issue Details</h3>
<ul dir="auto">
<li><strong>Electron Version:</strong>
<ul dir="auto">
<li>13.0.0-nightly.20201203</li>
</ul>
</li>
<li><strong>Operating System:</strong>
<ul dir="auto">
<li>macOS</li>
</ul>
</li>
<li><strong>Last Known Working Electron version:</strong>
<ul dir="auto">
<li>N/A</li>
</ul>
</li>
</ul>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto"><code class="notranslate">WebFrameMain.frames</code> should never contain undefined</p>
<h3 dir="auto">Actual Behavior</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Uncaught Exception:
TypeError: Cannot read property 'processId' of undefined
    at id (/private/var/folders/_7/jm5cr84j7jd4v7btf2d3bqwm0000gn/T/tmp-59557-p4DTr3KWOsNk/main.js:4:38)
    at pft (/private/var/folders/_7/jm5cr84j7jd4v7btf2d3bqwm0000gn/T/tmp-59557-p4DTr3KWOsNk/main.js:6:36)
    at Timeout._onTimeout (/private/var/folders/_7/jm5cr84j7jd4v7btf2d3bqwm0000gn/T/tmp-59557-p4DTr3KWOsNk/main.js:27:5)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)"><pre class="notranslate"><code class="notranslate">Uncaught Exception:
TypeError: Cannot read property 'processId' of undefined
    at id (/private/var/folders/_7/jm5cr84j7jd4v7btf2d3bqwm0000gn/T/tmp-59557-p4DTr3KWOsNk/main.js:4:38)
    at pft (/private/var/folders/_7/jm5cr84j7jd4v7btf2d3bqwm0000gn/T/tmp-59557-p4DTr3KWOsNk/main.js:6:36)
    at Timeout._onTimeout (/private/var/folders/_7/jm5cr84j7jd4v7btf2d3bqwm0000gn/T/tmp-59557-p4DTr3KWOsNk/main.js:27:5)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)
</code></pre></div>
<h3 dir="auto">To Reproduce</h3>
<p dir="auto">Run <a href="https://gist.github.com/f46823470955034b4a456b6275862bfb">https://gist.github.com/f46823470955034b4a456b6275862bfb</a> for a short while and you'll observe the above error.</p>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/samuelmaddock/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/samuelmaddock">@samuelmaddock</a></p>