8000 browser: Create separate request context for geolocation service. by deepak1556 · Pull Request #8923 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

browser: Create separate request context for geolocation service. #8923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 28, 2017

Conversation

deepak1556
Copy link
Member

This fixes a crash which happens when navigating from a webpage that uses geolocation service and then quitting the app. Test this after applying electron-archive/brightray#278

#2 0x7f329989b51c content::RenderProcessHostImpl::ClearWebRtcLogMessageCallback()
#3 0x7f329989a7b3 content::RenderProcessHostImpl::Cleanup()
#4 0x7f329991cf34 content::ServiceWorkerProcessManager::Shutdown()
#5 0x7f329996ff90 content::StoragePartitionImplMap::ForEach()
#6 0x7f329962aad8 content::BrowserContext::NotifyWillBeDestroyed()
#7 0x000000e49f91 brightray::BrowserContext::~BrowserContext()
#8 0x000000cd65fc atom::AtomBrowserContext::~AtomBrowserContext()
#9 0x000000cd6649 atom::AtomBrowserContext::~AtomBrowserContext()
#10 0x000000ba71ff base::RefCounted<>::Release()
#11 0x000000ba71a9 scoped_refptr<>::Release()
#12 0x000000b9ae1a scoped_refptr<>::~scoped_refptr()
#13 0x000000ccec30 atom::AtomAccessTokenStore::~AtomAccessTokenStore()
#14 0x000000ccecc9 atom::AtomAccessTokenStore::~AtomAccessTokenStore()
#15 0x7f32987e8fb6 device::LocationArbitrator::~LocationArbitrator()
#16 0x7f32987e9029 device::LocationArbitrator::~LocationArbitrator()
#17 0x7f3295a4a802 base::Thread::ThreadMain()
#18 0x7f3295a44e03 <unknown>
#19 0x7f328b9062e7 start_thread

To reproduce:

  • Navigate to youtube.com
  • Then navigate to google.com
  • window.history.back()
  • quit the qpp

The reason for the crash is that geolocation service is managed by a global leaky pointer, since we were holding a reference to browser context, it will therefore be destroyed at the end of everything and messes with the cleanup process.

This also Fixes #8754 , geolocation service has its own dedicated thread, the response from AtomAccessTokenStore were being sent back to IO thread instead, hence the UI freezed.

@zcbenz
Copy link
Contributor
zcbenz commented Mar 16, 2017

👍

@zcbenz zcbenz force-pushed the geolocation_request_context_patch branch from 1e5515f to 4f7721e Compare March 16, 2017 10:50
@zcbenz
Copy link
Contributor
zcbenz commented Mar 16, 2017

@deepak1556 I saw a crash on the CI machine, seems to be caused by electron-archive/brightray#278:

Application Specific Information:
Performing @selector(_close:) from sender _NSThemeCloseWidget 0x7fc7bd4a51f0

Thread 0 Crashed:: CrBrowserMain  Dispatch queue: com.apple.main-thread
0   ???                           	0x00007fc7bd7332b0 0 + 140495853662896
1   libcontent.dylib              	0x0000000111fafb03 content::RenderWidgetHostViewGuest::GetNativeView() const + 67
2   libcontent.dylib              	0x0000000112213a9a 0x111b7b000 + 6916762
3   com.github.electron.framework 	0x000000010cd8fe32 brightray::InspectableWebContentsImpl::CloseDevTools() + 370 (inspectable_web_contents_impl.cc:308)
4   com.github.electron.framework 	0x000000010cd96fd5 brightray::InspectableWebContentsImpl::CloseContents(content::WebContents*) + 37 (inspectable_web_contents_impl.cc:694)
5   com.github.electron.framework 	0x000000010cd8eb15 brightray::InspectableWebContentsImpl::~InspectableWebContentsImpl() + 261 (inspectable_web_contents_impl.cc:239)
6   com.github.electron.framework 	0x000000010cd8f0f5 brightray::InspectableWebContentsImpl::~InspectableWebContentsImpl() + 21 (inspectable_web_contents_impl.cc:241)
7   com.github.electron.framework 	0x000000010cd8f1d9 brightray::InspectableWebContentsImpl::~InspectableWebContentsImpl() + 25 (inspectable_web_contents_impl.cc:237)
8   com.github.electron.framework 	0x000000010cab06cf atom::CommonWebContentsDelegate::~CommonWebContentsDelegate() + 367 (memory:2783)
9   com.github.electron.framework 	0x000000010ca0d78b atom::api::WebContents::~WebContents() + 683 (atom_api_web_contents.cc:420)
10  com.github.electron.framework 	0x000000010ca0d865 atom::api::WebContents::~WebContents() + 21 (atom_api_web_contents.cc:420)
11  com.github.electron.framework 	0x000000010ca0d969 atom::api::WebContents::~WebContents() + 25 (atom_api_web_contents.cc:406)
12  com.github.electron.framework 	0x000000010cd4f917 mate::internal::Destroyable::Destroy(mate::Arguments*) + 71 (function_template.h:25)
13  com.github.electron.framework 	0x000000010cd4fbd5 void base::internal::FunctorTraits<void (*)(mate::Arguments*), void>::Invoke<mate::Arguments*>(void (*)(mate::Arguments*), mate::Arguments*&&) + 37 (bind_internal.h:164)
14  com.github.electron.framework 	0x000000010cd4fba0 void base::internal::InvokeHelper<false, void>::MakeItSo<void (* const&)(mate::Arguments*), mate::Arguments*>(void (* const&&&)(mate::Arguments*), mate::Arguments*&&) + 48 (bind_internal.h:285)
15  com.github.electron.framework 	0x000000010cd4fb61 void base::internal::Invoker<base::internal::BindState<void (*)(mate::Arguments*)>, void (mate::Arguments*)>::RunImpl<void (* const&)(mate::Arguments*), std::__1::tuple<> const&>(void (* const&&&)(mate::Arguments*), std::__1::tuple<> const&&&, base::IndexSequence<>, mate::Arguments*&&) + 49 (bind_internal.h:361)
16  com.github.electron.framework 	0x000000010cd4fae4 base::internal::Invoker<base::internal::BindState<void (*)(mate::Arguments*)>, void (mate::Arguments*)>::Run(base::internal::BindStateBase*, mate::Arguments*&&) + 68 (bind_internal.h:339)
17  com.github.electron.framework 	0x000000010c934771 base::internal::RunMixin<base::Callback<void (mate::Arguments*), (base::internal::CopyMode)1, (base::internal::RepeatMode)1> >::Run(mate::Arguments*) const + 81 (callback.h:64)
18  com.github.electron.framework 	0x000000010c934675 mate::internal::Invoker<mate::internal::IndicesHolder<0ul>, mate::Arguments*>::DispatchToCallback(base::Callback<void (mate::Arguments*), (base::internal::CopyMode)1, (base::internal::RepeatMode)1>) + 69 (function_template.h:202)
19  com.github.electron.framework 	0x000000010c939e3d mate::internal::Dispatcher<void (mate::Arguments*)>::DispatchToCallback(v8::FunctionCallbackInfo<v8::Value> const&) + 157 (function_template.h:236)
20  libv8.dylib                   	0x000000010e890df5 0x10e88b000 + 24053
21  libv8.dylib                   	0x000000010e917668 0x10e88b000 + 575080
22  libv8.dylib                   	0x000000010e916bc1 0x10e88b000 + 572353
23  ???                           	0x000027adf55843a7 0 + 43628099027879
24  ???                           	0x000027adf5e4603f 0 + 43628108210239
25  ???                           	0x000027adf5608afa 0 + 43628099570426
26  ???                           	0x000027adf55f23f8 0 + 43628099478520
27  ???                           	0x000027adf5585cd5 0 + 43628099034325
28  ???                           	0x000027adf5e34613 0 + 43628108138003
29  ???                           	0x000027adf5585cd5 0 + 43628099034325
30  ???                           	0x000027adf5d42909 0 + 43628107147529
31  ???                           	0x000027adf5585cd5 0 + 43628099034325
32  ???                           	0x000027adf55f1ac3 0 + 43628099476163
33  ???                           	0x000027adf55b65c1 0 + 43628099233217
34  libv8.dylib                   	0x000000010ec5c3c5 0x10e88b000 + 4002757
35  libv8.dylib                   	0x000000010ec5c129 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) + 169
36  libv8.dylib                   	0x000000010e8afdfb v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) + 459
37  libnode.dylib                 	0x000000010e00d781 node::MakeCallback(node::Environment*, v8::Local<v8::Value>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*) + 1393 (node.cc:1237)
38  libnode.dylib                 	0x000000010e00e3bb node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*) + 171 (node.cc:1360)
39  libnode.dylib                 	0x000000010e00e2d1 node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*) + 257 (node.cc:1340)
40  libnode.dylib                 	0x000000010e00e149 node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, char const*, int, v8::Local<v8::Value>*) + 105 (node.cc:1326)
41  com.github.electron.framework 	0x000000010cbe9a89 mate::internal::CallMethodWithArgs(v8::Isolate*, v8::Local<v8::Object>, char const*, std::__1::vector<v8::Local<v8::Value>, std::__1::allocator<v8::Local<v8::Value> > >*) + 121 (event_emitter_caller.cc:23)
42  com.github.electron.framework 	0x000000010c931942 v8::Local<v8::Value> mate::EmitEvent<base::BasicStringPiece<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, v8::Local<v8::Object> >(v8::Isolate*, v8::Local<v8::Object>, base::BasicStringPiece<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, v8::Local<v8::Object> const&) + 562 (event_emitter_caller.h:48)
43  com.github.electron.framework 	0x000000010ca2684d bool mate::EventEmitter<atom::api::WebContents>::EmitWithEvent<>(base::BasicStringPiece<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, v8::Local<v8::Object>) + 125 (event_emitter.h:98)
44  com.github.electron.framework 	0x000000010ca267a8 bool mate::EventEmitter<atom::api::WebContents>::EmitWithSender<>(base::BasicStringPiece<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, content::WebContents*, IPC::Message*) + 152 (event_emitter.h:84)
45  com.github.electron.framework 	0x000000010ca0e894 bool mate::EventEmitter<atom::api::WebContents>::Emit<>(base::BasicStringPiece<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&) + 36 (event_emitter.h:71)
46  com.github.electron.framework 	0x000000010ca13d22 atom::api::WebContents::WebContentsDestroyed() + 66 (atom_api_web_contents.cc:927)
47  libcontent.dylib              	0x00000001121f9971 content::WebContentsImpl::~WebContentsImpl() + 2465
48  libcontent.dylib              	0x00000001121fa22e content::WebContentsImpl::~WebContentsImpl() + 14
49  com.github.electron.framework 	0x000000010cd8ee56 brightray::InspectableWebContentsImpl::~InspectableWebContentsImpl() + 1094 (memory:2783)
50  com.github.electron.framework 	0x000000010cd8f0f5 brightray::InspectableWebContentsImpl::~InspectableWebContentsImpl() + 21 (inspectable_web_contents_impl.cc:241)
51  com.github.electron.framework 	0x000000010cd8f1d9 brightray::InspectableWebContentsImpl::~InspectableWebContentsImpl() + 25 (inspectable_web_contents_impl.cc:237)
52  com.github.electron.framework 	0x000000010cab1010 atom::CommonWebContentsDelegate::DestroyWebContents() + 160 (memory:2783)
53  com.github.electron.framework 	0x000000010ca540ca atom::api::Window::OnWindowClosed() + 42 (atom_api_window.cc:177)
54  com.github.electron.framework 	0x000000010cad2c6c atom::NativeWindow::NotifyWindowClosed() + 172 (native_window.cc:471)
55  com.github.electron.framework 	0x000000010cadb40b -[AtomNSWindowDelegate windowWillClose:] + 43
56  com.apple.CoreFoundation      	0x00007fff9940ebbc __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
57  com.apple.CoreFoundation      	0x00007fff9940eb4f ___CFXRegistrationPost_block_invoke + 63
58  com.apple.CoreFoundation      	0x00007fff9940eac7 _CFXRegistrationPost + 407
59  com.apple.CoreFoundation      	0x00007fff9940e832 ___CFXNotificationPost_block_invoke + 50
60  com.apple.CoreFoundation      	0x00007fff993cb5e2 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1922
61  com.apple.CoreFoundation      	0x00007fff993ca835 _CFXNotificationPost + 693
62  com.apple.Foundation          	0x00007fff9562117a -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
63  com.apple.AppKit              	0x00007fff9cfda213 __18-[NSWindow _close]_block_invoke + 184
64  com.apple.AppKit              	0x00007fff9cfda115 -[NSWindow _close] + 374
65  com.github.electron.framework 	0x000000010cae126b atom::NativeWindowMac::CloseImmediately() + 43 (native_window_mac.mm:856)
66  com.github.electron.framework 	0x000000010cad5768 atom::NativeWindow::CloseContents(content::WebContents*) + 264 (native_window.cc:443)
67  com.github.electron.framework 	0x000000010ca0e860 atom::api::WebContents::CloseContents(content::WebContents*) + 176 (atom_api_web_contents.cc:517)
68  com.github.electron.framework 	0x000000010cad537c atom::NativeWindow::RequestToClosePage() + 412 (native_window.cc:422)
69  com.github.electron.framework 	0x000000010cadb472 -[AtomNSWindowDelegate windowShouldClose:] + 50 (native_window_mac.mm:302)
70  com.apple.AppKit              	0x00007fff9d073e64 __19-[NSWindow __close]_block_invoke + 130
71  com.apple.AppKit              	0x00007fff9d073dd5 -[NSWindow __close] + 312
72  libsystem_trace.dylib         	0x00007fff9449107a _os_activity_initiate + 75
73  com.apple.AppKit              	0x00007fff9cf8edbd -[NSApplication sendAction:to:from:] + 460
74  com.apple.AppKit              	0x00007fff9cfa0f12 -[NSControl sendAction:to:] + 86
75  com.apple.AppKit              	0x00007fff9cfa0e3c __26-[NSCell _sendActionFrom:]_block_invoke + 131
76  libsystem_trace.dylib         	0x00007fff9449107a _os_activity_initiate + 75
77  com.apple.AppKit              	0x00007fff9cfa0d99 -[NSCell _sendActionFrom:] + 144
78  libsystem_trace.dylib         	0x00007fff9449107a _os_activity_initiate + 75
79  com.apple.AppKit              	0x00007fff9d00342a -[NSButtonCell performClick:] + 968
80  com.github.electron.framework 	0x000000010cae1213 atom::NativeWindowMac::Close() + 259 (native_window_mac.mm:852)
81  com.github.electron.framework 	0x000000010ca55538 atom::api::Window::Close() + 56 (atom_api_window.cc:322)
82  com.github.electron.framework 	0x000000010ca607a5 void base::internal::FunctorTraits<void (atom::api::Window::*)(), void>::Invoke<atom::api::Window*>(void (atom::api::Window::*)(), atom::api::Window*&&) + 133 (bind_internal.h:214)
83  com.github.electron.framework 	0x000000010ca60714 void base::internal::InvokeHelper<false, void>::MakeItSo<void (atom::api::Window::* const&)(), atom::api::Window*>(void (atom::api::Window::* const&&&)(), atom::api::Window*&&) + 68 (bind_internal.h:285)
84  com.github.electron.framework 	0x000000010ca606c1 void base::internal::Invoker<base::internal::BindState<void (atom::api::Window::*)()>, void (atom::api::Window*)>::RunImpl<void (atom::api::Window::* const&)(), std::__1::tuple<> const&>(void (atom::api::Window::* const&&&)(), std::__1::tuple<> const&&&, base::IndexSequence<>, atom::api::Window*&&) + 49 (bind_internal.h:361)
85  com.github.electron.framework 	0x000000010ca60644 base::internal::Invoker<base::internal::BindState<void (atom::api::Window::*)()>, void (atom::api::Window*)>::Run(base::internal::BindStateBase*, atom::api::Window*&&) + 68 (bind_internal.h:339)
86  com.github.electron.framework 	0x000000010ca60571 base::internal::RunMixin<base::Callback<void (atom::api::Window*), (base::internal::CopyMode)1, (base::internal::RepeatMode)1> >::Run(atom::api::Window*) const + 81 (callback.h:64)
87  com.github.electron.framework 	0x000000010ca5ff95 mate::internal::Invoker<mate::internal::IndicesHolder<0ul>, atom::api::Window*>::DispatchToCallback(base::Callback<void (atom::api::Window*), (base::internal::CopyMode)1, (base::internal::RepeatMode)1>) + 69 (function_template.h:202)
88  com.github.electron.framework 	0x000000010ca5fdbd mate::internal::Dispatcher<void (atom::api::Window*)>::DispatchToCallback(v8::FunctionCallbackInfo<v8::Value> const&) + 157 (function_template.h:236)
89  libv8.dylib                   	0x000000010e890df5 0x10e88b000 + 24053
90  libv8.dylib                   	0x000000010e917668 0x10e88b000 + 575080
91  libv8.dylib                   	0x000000010e916bc1 0x10e88b000 + 572353
92  ???                           	0x000027adf55843a7 0 + 43628099027879
93  ???                           	0x000027adf560915a 0 + 43628099572058
94  ???                           	0x000027adf55f23f8 0 + 43628099478520
95  ???                           	0x000027adf5608afa 0 + 43628099570426
96  ???                           	0x000027adf55f23f8 0 + 43628099478520
97  ???                           	0x000027adf5d421fe 0 + 43628107145726
98  ???                           	0x000027adf5585cd5 0 + 43628099034325
99  ???                           	0x000027adf5e0b9c9 0 + 43628107971017
100 ???                           	0x000027adf5d42617 0 + 43628107146775
101 ???                           	0x000027adf5585cd5 0 + 43628099034325
102 ???                           	0x000027adf55f1ac3 0 + 43628099476163
103 ???                           	0x000027adf55b65c1 0 + 43628099233217
104 libv8.dylib                   	0x000000010ec5c3c5 0x10e88b000 + 4002757
105 libv8.dylib                   	0x000000010ec5c129 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) + 169
106 libv8.dylib                   	0x000000010e8afdfb v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) + 459
107 libnode.dylib                 	0x000000010e00d781 node::MakeCallback(node::Environment*, v8::Local<v8::Value>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*) + 1393 (node.cc:1237)
108 libnode.dylib                 	0x000000010e00e3bb node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*) + 171 (node.cc:1360)
109 libnode.dylib                 	0x000000010e00e2d1 node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*) + 257 (node.cc:1340)
110 libnode.dylib                 	0x000000010e00e149 node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, char const*, int, v8::Local<v8::Value>*) + 105 (node.cc:1326)
111 com.github.electron.framework 	0x000000010cbe9a89 mate::internal::CallMethodWithArgs(v8::Isolate*, v8::Local<v8::Object>, char const*, std::__1::vector<v8::Local<v8::Value>, std::__1::allocator<v8::Local<v8::Value> > >*) + 121 (event_emitter_caller.cc:23)
112 com.github.electron.framework 	0x000000010ca497d6 v8::Local<v8::Value> mate::EmitEvent<base::BasicStringPiece<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, v8::Local<v8::Object>, base::ListValue>(v8::Isolate*, v8::Local<v8::Object>, base::BasicStringPiece<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, v8::Local<v8::Object> const&, base::ListValue const&) + 598 (event_emitter_caller.h:48)
113 com.github.electron.framework 	0x000000010ca494d1 bool mate::EventEmitter<atom::api::WebContents>::EmitWithEvent<base::ListValue>(base::BasicStringPiece<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, v8::Local<v8::Object>, base::ListValue const&) + 145 (event_emitter.h:98)
114 com.github.electron.framework 	0x000000010ca1e5f0 bool mate::EventEmitter<atom::api::WebContents>::EmitWithSender<base::ListValue>(base::BasicStringPiece<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, content::WebContents*, IPC::Message*, base::ListValue const&) + 160 (event_emitter.h:84)
115 com.github.electron.framework 	0x000000010ca13153 atom::api::WebContents::OnRendererMessageSync(std::__1::basic_string<unsigned short, base::string16_char_traits, std::__1::allocator<unsigned short> > const&, base::ListValue const&, IPC::Message*) + 131 (atom_api_web_contents.cc:1810)
116 com.github.electron.framework 	0x000000010ca2cfe0 void base::DispatchToMethodImpl<atom::api::WebContents*, void (atom::api::WebContents::*)(std::__1::basic_string<unsigned short, base::string16_char_traits, std::__1::allocator<unsigned short> > const&, base::ListValue const&, IPC::Message*), std::__1::tuple<std::__1::basic_string<unsigned short, base::string16_char_traits, std::__1::allocator<unsigned short> >, base::ListValue>&, std::__1::tuple<IPC::Message&>, 0ul, 1ul, 0ul>(atom::api::WebContents* const&, void (atom::api::WebContents::*)(std::__1::basic_string<unsigned short, base::string16_char_traits, std::__1::allocator<unsigned short> > const&, base::ListValue const&, IPC::Message*), std::__1::tuple<std::__1::basic_string<unsigned short, base::string16_char_traits, std::__1::allocator<unsigned short> >, base::ListValue>&&&, std::__1::tuple<IPC::Message&>*, base::IndexSequence<0ul, 1ul>, base::IndexSequence<0ul>) + 224 (tuple.h:186)
117 com.github.electron.framework 	0x000000010ca2cef8 void base::DispatchToMethod<atom::api::WebContents*, void (atom::api::WebContents::*)(std::__1::basic_string<unsigned short, base::string16_char_traits, std::__1::allocator<unsigned short> > const&, base::ListValue const&, IPC::Message*), std::__1::tuple<std::__1::basic_string<unsigned short, base::string16_char_traits, std::__1::allocator<unsigned short> >, base::ListValue>&, std::__1::tuple<IPC::Message&> >(atom::api::WebContents* const&, void (atom::api::WebContents::*)(std::__1::basic_string<unsigned short, base::string16_char_traits, std::__1::allocator<unsigned short> > const&, base::ListValue const&, IPC::Message*), std::__1::tuple<std::__1::basic_string<unsigned short, base::string16_char_traits, std::__1::allocator<unsigned short> >, base::ListValue>&&&, std::__1::tuple<IPC::Message&>*) + 104 (tuple.h:196)
118 com.github.electron.framework 	0x000000010ca13046 bool IPC::MessageT<AtomViewHostMsg_Message_Sync_Meta, std::__1::tuple<std::__1::basic_string<unsigned short, base::string16_char_traits, std::__1::allocator<unsigned short> >, base::ListValue>, std::__1::tuple<std::__1::basic_string<unsigned short, base::string16_char_traits, std::__1::allocator<unsigned short> > > >::DispatchDelayReply<atom::api::WebContents, void, void (atom::api::WebContents::*)(std::__1::basic_string<unsigned short, base::string16_char_traits, std::__1::allocator<unsigned short> > const&, base::ListValue const&, IPC::Message*)>(IPC::Message const*, atom::api::WebContents*, void*, void (atom::api::WebContents::*)(std::__1::basic_string<unsigned short, base::string16_char_traits, std::__1::allo
8000
cator<unsigned short> > const&, base::ListValue const&, IPC::Message*)) + 982 (ipc_message_templates.h:197)
119 com.github.electron.framework 	0x000000010ca12675 atom::api::WebContents::OnMessageReceived(IPC::Message const&) + 517 (atom_api_web_contents.cc:895)
120 libcontent.dylib              	0x00000001121fa7a6 content::WebContentsImpl::OnMessageReceived(content::RenderViewHost*, content::RenderFrameHost*, IPC::Message const&) + 614
121 libcontent.dylib              	0x000000011211090a content::RenderViewHostImpl::OnMessageReceived(IPC::Message const&) + 58
122 libcontent.dylib              	0x0000000112116b03 content::RenderWidgetHostImpl::OnMessageReceived(IPC::Message const&) + 51
123 libipc.dylib                  	0x0000000113e2a5eb IPC::ChannelProxy::Context::OnDispatchMessage(IPC::Message const&) + 91
124 libbase.dylib                 	0x000000010f348591 base::debug::TaskAnnotator::RunTask(char const*, base::PendingTask*) + 225
125 libbase.dylib                 	0x000000010f3769e6 base::MessageLoop::RunTask(base::PendingTask*) + 390
126 libbase.dylib                 	0x000000010f376cbc base::MessageLoop::DeferOrRunPendingTask(base::PendingTask) + 44
127 libbase.dylib                 	0x000000010f377073 base::MessageLoop::DoWork() + 371
128 libbase.dylib                 	0x000000010f379c9d 0x10f339000 + 265373
129 libbase.dylib                 	0x000000010f368cea base::mac::CallWithEHFrame(void () block_pointer) + 10
130 libbase.dylib                 	0x000000010f379714 0x10f339000 + 263956
131 com.apple.CoreFoundation      	0x00007fff99418881 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
132 com.apple.CoreFoundation      	0x00007fff993f7fbc __CFRunLoopDoSources0 + 556
133 com.apple.CoreFoundation      	0x00007fff993f74df __CFRunLoopRun + 927
134 com.apple.CoreFoundation      	0x00007fff993f6ed8 CFRunLoopRunSpecific + 296
135 com.apple.HIToolbox           	0x00007fff92f9b935 RunCurrentEventLoopInMode + 235
136 com.apple.HIToolbox           	0x00007fff92f9b76f ReceiveNextEventCommon + 432
137 com.apple.HIToolbox           	0x00007fff92f9b5af _BlockUntilNextEventMatchingListInModeWithFilter + 71
138 com.apple.AppKit              	0x00007fff9cd25df6 _DPSNextEvent + 1067
139 com.apple.AppKit              	0x00007fff9cd25226 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
140 com.apple.AppKit              	0x00007fff9cd19d80 -[NSApplication run] + 682
141 libbase.dylib                 	0x000000010f37a52e 0x10f339000 + 267566
142 libbase.dylib                 	0x000000010f379b5c 0x10f339000 + 265052
143 libbase.dylib                 	0x000000010f37674e base::MessageLoop::RunHandler() + 94
144 libbase.dylib                 	0x000000010f39e503 base::RunLoop::Run() + 115
145 libcontent.dylib              	0x0000000111ea0c0b content::BrowserMainLoop::MainMessageLoopRun() + 155
146 libcontent.dylib              	0x0000000111ea0a60 content::BrowserMainLoop::RunMainMessageLoopParts() + 64
147 libcontent.dylib              	0x0000000111ea3212 0x111b7b000 + 3310098
148 libcontent.dylib              	0x0000000111e9cb3c content::BrowserMain(content::MainFunctionParams const&) + 124
149 libcontent.dylib              	0x000000011252f70d 0x111b7b000 + 10176269
150 libcontent.dylib              	0x000000011252e926 content::ContentMain(content::ContentMainParams const&) + 54
151 com.github.electron.framework 	0x000000010c8fdda8 AtomMain + 104 (atom_library_main.mm:24)
152 com.github.electron           	0x000000010c8f4eff main + 79 (atom_main.cc:142)
153 libdyld.dylib                 	0x00007fff9d90a5ad start + 1

  * Geolocation service cannot hold reference to browser context,
    since it is destroyed at the end of everything and this will
    confuse the shutdown path of browser context.
  * Geolocation service run on its own thread.
@deepak1556 deepak1556 force-pushed the geolocation_request_context_patch branch from cc9de3c to 1f261ca Compare March 18, 2017 19:50
@deepak1556 deepak1556 force-pushed the geolocation_request_context_patch branch from 64a01bb to 72adbf7 Compare March 19, 2017 04:55
@deepak1556
Copy link
Member Author

@zcbenz have fixed the crash, thanks!

Depends on electron-archive/brightray#283

@@ -919,10 +923,6 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) {
// be destroyed on close, and WebContentsDestroyed would be called for it, so
// we need to make sure the api::WebContents is also deleted.
void WebContents::WebContentsDestroyed() {
// This event is only for internal use, which is emitted when WebContents is
// being destroyed.
Emit("will-destroy");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the meaning of will-destroy, for webview it is emitted before destroying WebContents, however for normal window now it is emitted after WebContents gets destroyed. While this works, it makes the closing logic more difficult to understand.

How about solving the crash with a fix like electron-archive/brightray#284?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

however for normal window now it is emitted after WebContents gets destroyed.

I just tested for normal window close and saw the event emitted before WebContentsDestroyed is called. The change here is that either scenario 1 or 3 of webContents destruction it will always invoke will-destroy before anything else and follow that InspectebWebContentsImpl gets to do the cleanup first. Is there something else that I missed ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you are right, I missed how WebContents is destroyed when window is closed.

// This event is only for internal use, which is emitted when WebContents is
// being destroyed.
Emit("will-destroy");
CommonWebContentsDelegate::DestroyWebContents();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CommonWebContentsDelegate::DestroyWebContents should be made a protected method and renamed to something else like ResetWebContents, having a non-virtual method with the same name is not good practice.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks!

@zcbenz
Copy link
Contributor
zcbenz commented Mar 28, 2017

👍

@zcbenz zcbenz merged commit 637bdc2 into master Mar 28, 2017
@zcbenz zcbenz deleted the geolocation_request_context_patch branch March 28, 2017 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

navigator.geolocation.getCurrentPosition freezes thread
2 participants
0