Issue 1:
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.

Issue Details

Electron Version:

10.1.3, 9.3.2

Operating System:

macOS & Windows

Last Known Working Electron version:

n/a

Expected Behavior

webview.loadURL() should either call .then during success or .catch during an error.

Actual Behavior

In some instances (fully reproducible Fiddle attached) it crashes the whole app. Namely, when on twitter.com and then navigating away the app crashes.

To Reproduce

index.html

<webview id="wv" src="https://twitter.com"></webview>

renderer.js

let done = false;
document.addEventListener('DOMContentLoaded', function() {
const wv = document.getElementById('wv');
wv.addEventListener('dom-ready', function() {
if (!done) {
done = true;
setTimeout(function () {
wv.loadURL('https://google.com');
}, 3000);
}
})
})

Fiddle: https://gist.github.com/iwiedenm/8373c65e5854089894aa4a288e576ad6

Fiddle is very simple... loads index.html and waits for the webview (starting on https://twitter.com) to be ready, then waits another few seconds and navigates to https://google.com. Then the whole app crashes.

Screenshots

Additional Information

Issue 2:
Version: 9.3.0, 10.1.1, 11.0.0-beta.4, master

Last working version: 8.5.0

To repro: load this gist and hit run. It will crash within a few seconds. https://gist.github.com/19fa4b45478032494306a7388e0804a2

Sometimes it will take a few navigations before it crashes; it's not 100% reliable.

Crash trace excerpt:

4 ??? 0x0000000000000000 0x0 + 0
5 Electron Framework 0x000000010885a576 content::RenderFrameHostManager::SetRWHViewForInnerContents(content::RenderWidgetHostView*) + 118
6 Electron Framework 0x0000000108d2ffa5 content::WebContentsImpl::ReattachToOuterWebContentsFrame() + 133
7 Electron Framework 0x0000000108d484cd content::WebContentsImpl::NotifyViewSwapped(content::RenderViewHost*, content::RenderViewHost*) + 909
8 Electron Framework 0x0000000108d518c8 content::WebContentsImpl::NotifySwappedFromRenderManager(content::RenderFrameHost*, content::RenderFrameHost*, bool) + 312
9 Electron Framework 0x0000000108852904 content::RenderFrameHostManager::CommitPending(std::__1::unique_ptr<content::RenderFrameHostImpl, std::__1::default_delete<content::RenderFrameHostImpl> >, std::__1::unique_ptr<content::BackForwardCacheImpl::Entry, std::__1::default_delete<content::BackForwardCacheImpl::Entry> >, bool) + 1940
10 Electron Framework 0x0000000108851fcf content::RenderFrameHostManager::CommitPendingIfNecessary(content::RenderFrameHostImpl*, bool, bool, bool) + 399
11 Electron Framework 0x0000000108851e17 content::RenderFrameHostManager::DidNavigateFrame(content::RenderFrameHostImpl*, bool, bool, bool, blink::FramePolicy const&) + 23
[...]

Full stack trace

Received signal 11 SEGV_MAPERR 000000000050
0 Electron Framework 0x0000000109cf8d79 base::debug::CollectStackTrace(void**, unsigned long) + 9
1 Electron Framework 0x0000000109bf33f3 base::debug::StackTrace::StackTrace() + 19
2 Electron Framework 0x0000000109cf8c41 base::debug::(anonymous namespace)::StackDumpSignalHandler(int, __siginfo*, void*) + 2385
3 libsystem_platform.dylib 0x00007fff73e0d42d _sigtramp + 29
4 ??? 0x0000000000000000 0x0 + 0
5 Electron Framework 0x000000010885a576 content::RenderFrameHostManager::SetRWHViewForInnerContents(content::RenderWidgetHostView*) + 118
6 Electron Framework 0x0000000108d2ffa5 content::WebContentsImpl::ReattachToOuterWebContentsFrame() + 133
7 Electron Framework 0x0000000108d484cd content::WebContentsImpl::NotifyViewSwapped(content::RenderViewHost*, content::RenderViewHost*) + 909
8 Electron Framework 0x0000000108d518c8 content::WebContentsImpl::NotifySwappedFromRenderManager(content::RenderFrameHost*, content::RenderFrameHost*, bool) + 312
9 Electron Framework 0x0000000108852904 content::RenderFrameHostManager::CommitPending(std::__1::unique_ptr<content::RenderFrameHostImpl, std::__1::default_delete<content::RenderFrameHostImpl> >, std::__1::unique_ptr<content::BackForwardCacheImpl::Entry, std::__1::default_delete<content::BackForwardCacheImpl::Entry> >, bool) + 1940
10 Electron Framework 0x0000000108851fcf content::RenderFrameHostManager::CommitPendingIfNecessary(content::RenderFrameHostImpl*, bool, bool, bool) + 399
11 Electron Framework 0x0000000108851e17 content::RenderFrameHostManager::DidNavigateFrame(content::RenderFrameHostImpl*, bool, bool, bool, blink::FramePolicy const&) + 23
12 Electron Framework 0x0000000108809d6f content::Navigator::DidNavigate(content::RenderFrameHostImpl*, FrameHostMsg_DidCommitProvisionalLoad_Params const&, std::__1::unique_ptr<content::NavigationRequest, std::__1::default_delete<content::NavigationRequest> >, bool) + 495
13 Electron Framework 0x0000000108820974 content::RenderFrameHostImpl::DidCommitNavigationInternal(std::__1::unique_ptr<content::NavigationRequest, std::__1::default_delete<content::NavigationRequest> >, std::__1::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params, std::__1::default_delete<FrameHostMsg_DidCommitProvisionalLoad_Params> >, bool) + 2820
14 Electron Framework 0x000000010881fa9d content::RenderFrameHostImpl::DidCommitNavigation(std::__1::unique_ptr<content::NavigationRequest, std::__1::default_delete<content::NavigationRequest> >, std::__1::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params, std::__1::default_delete<FrameHostMsg_DidCommitProvisionalLoad_Params> >, mojo::StructPtr<content::mojom::DidCommitProvisionalLoadInterfaceParams>) + 1085
15 Electron Framework 0x00000001088212e5 content::RenderFrameHostImpl::DidCommitPerNavigationMojoInterfaceNavigation(content::NavigationRequest*, std::__1::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params, std::__1::default_delete<FrameHostMsg_DidCommitProvisionalLoad_Params> >, mojo::StructPtr<content::mojom::DidCommitProvisionalLoadInterfaceParams>) + 341
16 Electron Framework 0x000000010884fdf2 base::internal::Invoker<base::internal::BindState<void (content::RenderFrameHostImpl::*)(content::NavigationRequest*, std::__1::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params, std::__1::default_delete<FrameHostMsg_DidCommitProvisionalLoad_Params> >, mojo::StructPtr<content::mojom::DidCommitProvisionalLoadInterfaceParams>), base::internal::UnretainedWrapper<content::RenderFrameHostImpl>, content::NavigationRequest*>, void (std::__1::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params, std::__1::default_delete<FrameHostMsg_DidCommitProvisionalLoad_Params> >, mojo::StructPtr<content::mojom::DidCommitProvisionalLoadInterfaceParams>)>::RunOnce(base::internal::BindStateBase*, std::__1::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params, std::__1::default_delete<FrameHostMsg_DidCommitProvisionalLoad_Params> >&&, mojo::StructPtr<content::mojom::DidCommitProvisionalLoadInterfaceParams>&&) + 82
17 Electron Framework 0x0000000105d82f0e content::mojom::NavigationClient_CommitNavigation_ForwardToCallback::Accept(mojo::Message*) + 478
18 Electron Framework 0x000000010a197ff6 mojo::InterfaceEndpointClient::HandleValidatedMessage(mojo::Message*) + 1462
19 Electron Framework 0x000000010a19bbdb mojo::MessageDispatcher::Accept(mojo::Message*) + 251
20 Electron Framework 0x000000010a199361 mojo::InterfaceEndpointClient::HandleIncomingMessage(mojo::Message*) + 97
21 Electron Framework 0x000000010a1f9df6 IPC::(anonymous namespace)::ChannelAssociatedGroupController::AcceptOnProxyThread(mojo::Message) + 630
22 Electron Framework 0x000000010a1f6e9c base::internal::Invoker<base::internal::BindState<void (IPC::(anonymous namespace)::ChannelAssociatedGroupController::*)(mojo::Message), scoped_refptr<IPC::(anonymous namespace)::ChannelAssociatedGroupController>, mojo::Message>, void ()>::RunOnce(base::internal::BindStateBase*) + 140
23 Electron Framework 0x0000000109c88dbb base::TaskAnnotator::RunTask(char const*, base::PendingTask*) + 411
24 Electron Framework 0x0000000109ca7da7 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::sequence_manager::LazyNow*) + 519
25 Electron Framework 0x0000000109ca7a18 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() + 168
26 Electron Framework 0x0000000109d19511 base::MessagePumpCFRunLoopBase::RunWork() + 65
27 Electron Framework 0x0000000109d0e5a2 base::mac::CallWithEHFrame(void () block_pointer) + 10
28 Electron Framework 0x0000000109d18edf base::MessagePumpCFRunLoopBase::RunWorkSource(void*) + 63
29 CoreFoundation 0x00007fff3c570b21 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
30 CoreFoundation 0x00007fff3c570ac0 __CFRunLoopDoSource0 + 103
31 CoreFoundation 0x00007fff3c5708d4 __CFRunLoopDoSources0 + 209
32 CoreFoundation 0x00007fff3c56f740 __CFRunLoopRun + 1272
33 CoreFoundation 0x00007fff3c56ebd3 CFRunLoopRunSpecific + 499
34 HIToolbox 0x00007fff3b0c465d RunCurrentEventLoopInMode + 292
35 HIToolbox 0x00007fff3b0c439d ReceiveNextEventCommon + 600
36 HIToolbox 0x00007fff3b0c4127 _BlockUntilNextEventMatchingListInModeWithFilter + 64
37 AppKit 0x00007fff39734ba4 _DPSNextEvent + 990
38 AppKit 0x00007fff39733380 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
39 AppKit 0x00007fff3972509e -[NSApplication run] + 658
40 Electron Framework 0x0000000109d1a4cc base::MessagePumpNSApplication::DoRun(base::MessagePump::Delegate*) + 348
41 Electron Framework 0x0000000109d189e2 base::MessagePumpCFRunLoopBase::Run(base::MessagePump::Delegate*) + 130
42 Electron Framework 0x0000000109ca85dd base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta) + 349
43 Electron Framework 0x0000000109c5bf2c base::RunLoop::Run() + 956
44 Electron Framework 0x00000001085bfe4b content::BrowserMainLoop::RunMainMessageLoopParts() + 203
45 Electron Framework 0x00000001085c2212 content::BrowserMainRunnerImpl::Run() + 82
46 Electron Framework 0x00000001085bc96b content::BrowserMain(content::MainFunctionParams const&) + 267
47 Electron Framework 0x00000001083d282e content::ContentMainRunnerImpl::RunServiceManager(content::MainFunctionParams&, bool) + 1406
48 Electron Framework 0x00000001083d2283 content::ContentMainRunnerImpl::Run(bool) + 467
49 Electron Framework 0x000000010c42c11e service_manager::Main(service_manager::MainParams const&) + 3310
50 Electron Framework 0x00000001063095c8 content::ContentMain(content::ContentMainParams const&) + 120
51 Electron Framework 0x00000001043fadc6 ElectronMain + 134
52 Electron 0x0000000103835551 main + 289
53 libdyld.dylib 0x00007fff73c147fd start + 1
54 ??? 0x0000000000000002 0x0 + 2