<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>[] 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>
<p dir="auto">Electron version: v5.0.1<br>
Operating system: MaxOS 10.14.4</p>
<h3 dir="auto">Expected Behavior</h3>

<p dir="auto">As doc <a href="https://electronjs.org/docs/api/shell#shellopenexternalurl-options" rel="nofollow">https://electronjs.org/docs/api/shell#shellopenexternalurl-options</a></p>
<h3 dir="auto">Actual Behavior</h3>

<p dir="auto">Link opened in the browser, but the browser is not brought to the foreground.</p>
<h3 dir="auto">To Reproduce</h3>
<p dir="auto">Upgrade electron to v5.0.1 in <a href="https://github.com/electron/electron-api-demos">https://github.com/electron/electron-api-demos</a></p>
<p dir="auto">And try "open external links" demo</p>
<ul dir="auto">
<li>Electron version: 1.4.7</li>
<li>Operating system: Mac OS 10.11.6 &amp; Ubuntu 14.04</li>
</ul>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">Garbage collector should clean memory.</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">Memory usage increases rapidly in Main process. Eventually app performance will degrade until unusable.</p>
<h3 dir="auto">How to reproduce</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const path = require('path');
const {app, BrowserWindow} = require('electron');
app.disableHardwareAcceleration();

app.once('ready', () =&gt; {
  const win = new BrowserWindow({
    width: 4096,
    height: 3072,
    useContentSize: true,
    enableLargerThanScreen: true,
    show: false,
    frame: false,
    hasShadow: false,
    transparent: true,
    webPreferences: {
      devTools: false,
      webSecurity: false,
      textAreasAreResizable: false,
      defaultEncoding: 'utf8',
      backgroundThrottling: false,
      offscreen: true,
      zoomFactor: 1,
      experimentalFeatures: false,
      experimentalCanvasFeatures: false
    }
  });

  let index = 0;
  const sizes = [
    {width: 1024, height: 768},
    {width: 2048, height: 1536},
    {width: 4096, height: 3072}
  ];

  win.loadURL('https://www.apple.com');
  win.webContents.setFrameRate(60);
  win.webContents.once('dom-ready', () =&gt; {
    setInterval(() =&gt; {
      if (index === sizes.length) {
        index = 0;
      }
      const size = sizes[index++];

      // changing the window size causes the memory leak
      win.setSize(size.width, size.height, false);
    }, 100);
  })
});
"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">path</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'path'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">const</span> <span class="pl-kos">{</span>app<span class="pl-kos">,</span> BrowserWindow<span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'electron'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-s1">app</span><span class="pl-kos">.</span><span class="pl-en">disableHardwareAcceleration</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-s1">app</span><span class="pl-kos">.</span><span class="pl-en">once</span><span class="pl-kos">(</span><span class="pl-s">'ready'</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-k">const</span> <span class="pl-s1">win</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-v">BrowserWindow</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
    <span class="pl-c1">width</span>: <span class="pl-c1">4096</span><span class="pl-kos">,</span>
    <span class="pl-c1">height</span>: <span class="pl-c1">3072</span><span class="pl-kos">,</span>
    <span class="pl-c1">useContentSize</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
    <span class="pl-c1">enableLargerThanScreen</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
    <span class="pl-c1">show</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
    <span class="pl-c1">frame</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
    <span class="pl-c1">hasShadow</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
    <span class="pl-c1">transparent</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
    <span class="pl-c1">webPreferences</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">devTools</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
      <span class="pl-c1">webSecurity</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
      <span class="pl-c1">textAreasAreResizable</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
      <span class="pl-c1">defaultEncoding</span>: <span class="pl-s">'utf8'</span><span class="pl-kos">,</span>
      <span class="pl-c1">backgroundThrottling</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
      <span class="pl-c1">offscreen</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
      <span class="pl-c1">zoomFactor</span>: <span class="pl-c1">1</span><span class="pl-kos">,</span>
      <span class="pl-c1">experimentalFeatures</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
      <span class="pl-c1">experimentalCanvasFeatures</span>: <span class="pl-c1">false</span>
    <span class="pl-kos">}</span>
  <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

  <span class="pl-k">let</span> <span class="pl-s1">index</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span><span class="pl-kos">;</span>
  <span class="pl-k">const</span> <span class="pl-s1">sizes</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span>
    <span class="pl-kos">{</span><span class="pl-c1">width</span>: <span class="pl-c1">1024</span><span class="pl-kos">,</span> <span class="pl-c1">height</span>: <span class="pl-c1">768</span><span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">{</span><span class="pl-c1">width</span>: <span class="pl-c1">2048</span><span class="pl-kos">,</span> <span class="pl-c1">height</span>: <span class="pl-c1">1536</span><span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">{</span><span class="pl-c1">width</span>: <span class="pl-c1">4096</span><span class="pl-kos">,</span> <span class="pl-c1">height</span>: <span class="pl-c1">3072</span><span class="pl-kos">}</span>
  <span class="pl-kos">]</span><span class="pl-kos">;</span>

  <span class="pl-s1">win</span><span class="pl-kos">.</span><span class="pl-en">loadURL</span><span class="pl-kos">(</span><span class="pl-s">'https://www.apple.com'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-s1">win</span><span class="pl-kos">.</span><span class="pl-c1">webContents</span><span class="pl-kos">.</span><span class="pl-en">setFrameRate</span><span class="pl-kos">(</span><span class="pl-c1">60</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-s1">win</span><span class="pl-kos">.</span><span class="pl-c1">webContents</span><span class="pl-kos">.</span><span class="pl-en">once</span><span class="pl-kos">(</span><span class="pl-s">'dom-ready'</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-en">setInterval</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
      <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">index</span> <span class="pl-c1">===</span> <span class="pl-s1">sizes</span><span class="pl-kos">.</span><span class="pl-c1">length</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-s1">index</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span><span class="pl-kos">;</span>
      <span class="pl-kos">}</span>
      <span class="pl-k">const</span> <span class="pl-s1">size</span> <span class="pl-c1">=</span> <span class="pl-s1">sizes</span><span class="pl-kos">[</span><span class="pl-s1">index</span><span class="pl-c1">++</span><span class="pl-kos">]</span><span class="pl-kos">;</span>

      <span class="pl-c">// changing the window size causes the memory leak</span>
      <span class="pl-s1">win</span><span class="pl-kos">.</span><span class="pl-en">setSize</span><span class="pl-kos">(</span><span class="pl-s1">size</span><span class="pl-kos">.</span><span class="pl-c1">width</span><span class="pl-kos">,</span> <span class="pl-s1">size</span><span class="pl-kos">.</span><span class="pl-c1">height</span><span class="pl-kos">,</span> <span class="pl-c1">false</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-c1">100</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>