<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> 8.1.1</li>
<li><strong>Operating System:</strong> Windows 10 (1709)</li>
<li><strong>Last Known Working Electron version:</strong> n/a - relates to new allowRendererProcessReuse flag; works fine without it</li>
</ul>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">I am using Node's http/https modules to ping a site in a renderer process. I expect that I can successfully ping a site like "<a href="https://google.com" rel="nofollow">https://google.com</a>" without timing out when <code class="notranslate">app.allowRendererProcessReuse</code> is <code class="notranslate">true</code>.</p>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">The request always times out.</p>
<h3 dir="auto">To Reproduce</h3>
<p dir="auto">Code below, but the gist is this.</p>
<p dir="auto">I navigate a window to a page. Then, I navigate the window to another page and ping the site with the http/https modules.</p>
<p dir="auto">When <code class="notranslate">allowRendererProcessReuse</code> is set, the requests always time out.</p>
<p dir="auto">When I unset the flag, everything works fine.<br>
When I load the second page (that makes the requests) instead of the first, everything works fine.<br>
When I explicitly kill the renderer process from the first navigation, and then do the second navigation, everything works fine.</p>
<p dir="auto">Something about keeping the old renderer around makes it not work for some reason.</p>
<p dir="auto">main.ts:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import &quot;electron&quot;;

function createMainWindow(): void {
	const { BrowserWindow, ipcMain } = require(&quot;electron&quot;);

	const mainWindow: Electron.BrowserWindow = new BrowserWindow({
		show: true,
		webPreferences: {
			nodeIntegration: true
		}
	});

	mainWindow.loadFile(&quot;./firstPage.html&quot;); // Workaround 2: load the secondPage instead of the firstPage

	ipcMain.once(&quot;next&quot;, () =&gt; {
		mainWindow.loadFile(&quot;./secondPage.html&quot;);
		mainWindow.webContents.openDevTools();
	});
}

export async function main(): Promise&lt;void&gt; {
	const { app } = require(&quot;electron&quot;);

	app.allowRendererProcessReuse = true; // Workaround 1: comment this out

	app.on(&quot;window-all-closed&quot;, () =&gt; {
		app.quit();
	});

	await app.whenReady();
	createMainWindow();
}

if (require.main === module) {
	main();
}"><pre class="notranslate"><code class="notranslate">import "electron";

function createMainWindow(): void {
	const { BrowserWindow, ipcMain } = require("electron");

	const mainWindow: Electron.BrowserWindow = new BrowserWindow({
		show: true,
		webPreferences: {
			nodeIntegration: true
		}
	});

	mainWindow.loadFile("./firstPage.html"); // Workaround 2: load the secondPage instead of the firstPage

	ipcMain.once("next", () =&gt; {
		mainWindow.loadFile("./secondPage.html");
		mainWindow.webContents.openDevTools();
	});
}

export async function main(): Promise&lt;void&gt; {
	const { app } = require("electron");

	app.allowRendererProcessReuse = true; // Workaround 1: comment this out

	app.on("window-all-closed", () =&gt; {
		app.quit();
	});

	await app.whenReady();
	createMainWindow();
}

if (require.main === module) {
	main();
}
</code></pre></div>
<p dir="auto">firstPage.html:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;!DOCTYPE html&gt;
&lt;html&gt;

&lt;body&gt;
	&lt;button id=&quot;acceptButton&quot;&gt;Accept&lt;/button&gt;
	&lt;script src=&quot;./firstPage.ts&quot;&gt;&lt;/script&gt;
&lt;/body&gt;

&lt;/html&gt;"><pre class="notranslate"><code class="notranslate">&lt;!DOCTYPE html&gt;
&lt;html&gt;

&lt;body&gt;
	&lt;button id="acceptButton"&gt;Accept&lt;/button&gt;
	&lt;script src="./firstPage.ts"&gt;&lt;/script&gt;
&lt;/body&gt;

&lt;/html&gt;
</code></pre></div>
<p dir="auto">firstPage.ts:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="document.getElementById(&quot;acceptButton&quot;).onclick = () =&gt; {
	require(&quot;electron&quot;).ipcRenderer.send(&quot;next&quot;);
	// Workaround 3: Do a process.exit() here and await the loadFile(secondPage) navigation. This causes us to create a new renderer process
};"><pre class="notranslate"><code class="notranslate">document.getElementById("acceptButton").onclick = () =&gt; {
	require("electron").ipcRenderer.send("next");
	// Workaround 3: Do a process.exit() here and await the loadFile(secondPage) navigation. This causes us to create a new renderer process
};
</code></pre></div>
<p dir="auto">secondPage.html:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;!DOCTYPE html&gt;
&lt;html&gt;

&lt;body&gt;
	&lt;div id=&quot;controlDiv&quot;&gt;
		&lt;input id=&quot;url&quot; type=&quot;url&quot; value=&quot;https://google.com&quot; /&gt;
		&lt;button id=&quot;navigateButton&quot;&gt;Navigate&lt;/button&gt;
	&lt;/div&gt;

	&lt;script src=&quot;./secondPage.js&quot;&gt;&lt;/script&gt;
&lt;/body&gt;

&lt;/html&gt;"><pre class="notranslate"><code class="notranslate">&lt;!DOCTYPE html&gt;
&lt;html&gt;

&lt;body&gt;
	&lt;div id="controlDiv"&gt;
		&lt;input id="url" type="url" value="https://google.com" /&gt;
		&lt;button id="navigateButton"&gt;Navigate&lt;/button&gt;
	&lt;/div&gt;

	&lt;script src="./secondPage.js"&gt;&lt;/script&gt;
&lt;/body&gt;

&lt;/html&gt;
</code></pre></div>
<p dir="auto">secondPage.ts:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const https = require(&quot;https&quot;);
const http = require(&quot;http&quot;);
const dialog = require(&quot;electron&quot;).remote.dialog;

document.getElementById(&quot;navigateButton&quot;).onclick = () =&gt; {
	const url: string = (document.getElementById(&quot;url&quot;) as HTMLInputElement).value.trim();

	const parsedURL: URL = new URL(url);
	let requestMethod = http.request;
	if (parsedURL.protocol === &quot;https:&quot;) {
		requestMethod = https.request;
	}

	const clientRequest = requestMethod(url, { method: &quot;HEAD&quot;, timeout: 3000 }, () =&gt; {
		dialog.showMessageBox({ message: &quot;valid&quot; });
	});

	clientRequest.on(&quot;timeout&quot;, () =&gt; {
		dialog.showMessageBox({ message: &quot;timed out&quot; });
		clientRequest.abort();
	});

	clientRequest.end();
};"><pre class="notranslate"><code class="notranslate">const https = require("https");
const http = require("http");
const dialog = require("electron").remote.dialog;

document.getElementById("navigateButton").onclick = () =&gt; {
	const url: string = (document.getElementById("url") as HTMLInputElement).value.trim();

	const parsedURL: URL = new URL(url);
	let requestMethod = http.request;
	if (parsedURL.protocol === "https:") {
		requestMethod = https.request;
	}

	const clientRequest = requestMethod(url, { method: "HEAD", timeout: 3000 }, () =&gt; {
		dialog.showMessageBox({ message: "valid" });
	});

	clientRequest.on("timeout", () =&gt; {
		dialog.showMessageBox({ message: "timed out" });
		clientRequest.abort();
	});

	clientRequest.end();
};
</code></pre></div>
<p dir="auto">Start the app. Click the button to go to the second page. Click the navigate button (or try another URL). You will see the "timed out" dialog appear instead of the "valid" dialog.</p>
<ul dir="auto">
<li>Electron version: 1.6.8</li>
<li>Operating system: MacOS</li>
</ul>
<p dir="auto">Apologies if this is a duplicate, I found issues related to <code class="notranslate">window.open</code>, however I believe none covered my use case</p>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">Communication between an iframe and windows it opens should be possible (via <code class="notranslate">postMessage</code> API). Therefore, <code class="notranslate">window.open</code> should behave correctly when used within an iframe.</p>
<h4 dir="auto">Opener to opened</h4>
<p dir="auto">Calling <code class="notranslate">window.open</code> from within an iframe should return the created <code class="notranslate">BrowserProxyWindow</code>, allowing the <strong>opener</strong> to post messages to the <strong>opened</strong></p>
<h4 dir="auto">Opened to opener</h4>
<p dir="auto">The opened windows <code class="notranslate">window.opener</code> should point back to the iframes window (the window that opened it), allowing the <strong>opened</strong> to post messages to the <strong>opener</strong></p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">Communication between the opener and the opened window is broken in both directions when the<br>
opener is an iframe.</p>
<h4 dir="auto">Opener to opened</h4>
<p dir="auto"><code class="notranslate">window.open</code> returns <code class="notranslate">null</code> when called within an iframe. Therefore,  it is impossible for the opener to communicate to the opened window.</p>
<p dir="auto"><code class="notranslate">window.open</code> uses Chromiums implementation instead of Electron's proxy from within an iframe.</p>
<h4 dir="auto">Opened to opener</h4>
<p dir="auto"><code class="notranslate">window.opener</code> points to <code class="notranslate">top</code> instead of the iframe which opened the window. Therefore, it is impossible to communicate from the opened window to the opener window (the iframe).</p>
<h3 dir="auto">How to reproduce</h3>
<p dir="auto">The easiest way to reproduce is to:</p>
<ol dir="auto">
<li>open up the example electron app</li>
<li>open dev tools and insert an iframe</li>
<li>from dev tools console set the context to the iframe, and execute <code class="notranslate">window.open</code> (it will return <code class="notranslate">null</code>)</li>
<li>open the dev tools in the opened window and inspect <code class="notranslate">window.opener</code>... it will NOT point to the opener (the iframe) instead it will be pointing at <code class="notranslate">top</code></li>
</ol>