Issue 1:
Issue Details

Electron Version:

v6.0.0

Operating System:

MacOS 10.14

Last Known Working Electron version:

N/A

Expected Behavior

Functional example code that prevents navigation.

Actual Behavior

Call back is not called, behavoir is not prevented, depending on project blank HTML document is sometimes loaded.

To Reproduce

Clone the Electron Quick Start project

Update main.js with the code below

Execute window.location = 'https://example.com'

Note navigation occurs and no console.log output

main.js

// Modules to control application life and create native browser window
const {
app,
BrowserWindow
} = require('electron')
const path = require('path')

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow

function createWindow() {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
sandbox: true,
webSecurity: true,
contextIsolation: true,
webviewTag: false,
enableRemoteModule: false,
allowRunningInsecureContent: false,
nodeIntegration: false,
nodeIntegrationInWorker: false,
nodeIntegrationInSubFrames: false,
nativeWindowOpen: false,
safeDialogs: true,
preload: path.join(__dirname, 'preload.js')
}
})

// and load the index.html of the app.
mainWindow.loadFile('index.html')

// Open the DevTools.
mainWindow.webContents.openDevTools()

// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)

// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') app.quit()
})

app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) createWindow()
})

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
app.on('web-contents-created', (_, contents) => {
contents.on('will-navigate', (event, navigationUrl) => {
console.log(`[will-navigate] ${navigationUrl}`)
event.preventDefault()
})
})

Issue 2:
Preflight Checklist

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. This might be a duplicate of #17617 but I have no idea how to check.

Issue Details

Electron Version:

3.1.6 (Visual Studio Code 1.33.1)

Operating System:

macOS 10.14.4

Last Known Working Electron version::

N/A

Expected Behavior

No crash.

Actual Behavior

The app crashes.

To Reproduce

Not quite sure how to reproduce, but the crash is from Visual Studio Code.

Screenshots

N/A

Additional Information

Crash report: Electron.crash

I've narrowed it down to somewhere in this function:

electron/atom/browser/window_list.cc

Lines 82 to 90
in
73158a6

void WindowList::CloseAllWindows() {

WindowVector windows = GetInstance()->windows_;

#if defined(OS_MACOSX)

std::reverse(windows.begin(), windows.end());

#endif

for (auto* const& window : windows)

if (!window->IsClosed())

window->Close();

}

Sorry if I haven't provided enough information, if I'm missing anything please let me know.