Issue 1:
I have read the Contributing Guidelines for this project.

I agree to follow the Code of Conduct that this project adheres to.

I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

Electron Version: 8.1.1

Operating System: Windows 10 (1709)

Last Known Working Electron version: n/a - relates to new allowRendererProcessReuse flag; works fine without it

Expected Behavior

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 "https://google.com" without timing out when app.allowRendererProcessReuse is true.

Actual Behavior

The request always times out.

To Reproduce

Code below, but the gist is this.

I navigate a window to a page. Then, I navigate the window to another page and ping the site with the http/https modules.

When allowRendererProcessReuse is set, the requests always time out.

When I unset the flag, everything works fine.

When I load the second page (that makes the requests) instead of the first, everything works fine.

When I explicitly kill the renderer process from the first navigation, and then do the second navigation, everything works fine.

Something about keeping the old renderer around makes it not work for some reason.

main.ts:

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", () => {
mainWindow.loadFile("./secondPage.html");
mainWindow.webContents.openDevTools();
});
}

export async function main(): Promise<void> {
const { app } = require("electron");

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

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

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

if (require.main === module) {
main();
}

firstPage.html:

<!DOCTYPE html>
<html>

<body>
<button id="acceptButton">Accept</button>
<script src="./firstPage.ts"></script>
</body>

</html>

firstPage.ts:

document.getElementById("acceptButton").onclick = () => {
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
};

secondPage.html:

<!DOCTYPE html>
<html>

<body>
<div id="controlDiv">
<input id="url" type="url" value="https://google.com" />
<button id="navigateButton">Navigate</button>
</div>

<script src="./secondPage.js"></script>
</body>

</html>

secondPage.ts:

const https = require("https");
const http = require("http");
const dialog = require("electron").remote.dialog;

document.getElementById("navigateButton").onclick = () => {
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 }, () => {
dialog.showMessageBox({ message: "valid" });
});

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

clientRequest.end();
};

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.

Issue 2:
Electron version: 1.6.8

Operating system: MacOS

Apologies if this is a duplicate, I found issues related to window.open, however I believe none covered my use case

Expected behavior

Communication between an iframe and windows it opens should be possible (via postMessage API). Therefore, window.open should behave correctly when used within an iframe.

Opener to opened

Calling window.open from within an iframe should return the created BrowserProxyWindow, allowing the opener to post messages to the opened

Opened to opener

The opened windows window.opener should point back to the iframes window (the window that opened it), allowing the opened to post messages to the opener

Actual behavior

Communication between the opener and the opened window is broken in both directions when the

opener is an iframe.

Opener to opened

window.open returns null when called within an iframe. Therefore, it is impossible for the opener to communicate to the opened window.

window.open uses Chromiums implementation instead of Electron's proxy from within an iframe.

Opened to opener

window.opener points to top instead of the iframe which opened the window. Therefore, it is impossible to communicate from the opened window to the opener window (the iframe).

How to reproduce

The easiest way to reproduce is to:

open up the example electron app

open dev tools and insert an iframe

from dev tools console set the context to the iframe, and execute window.open (it will return null)

open the dev tools in the opened window and inspect window.opener... it will NOT point to the opener (the iframe) instead it will be pointing at top