fix: libuv hang when nodeIntegrationInSubframes enabled (#27582)
This commit is contained in:
parent
980b32fce7
commit
642d6fca91
3 changed files with 19 additions and 2 deletions
|
@ -531,6 +531,18 @@ void NodeBindings::LoadEnvironment(node::Environment* env) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeBindings::PrepareMessageLoop() {
|
void NodeBindings::PrepareMessageLoop() {
|
||||||
|
#if !defined(OS_WIN)
|
||||||
|
int handle = uv_backend_fd(uv_loop_);
|
||||||
|
#else
|
||||||
|
HANDLE handle = uv_loop_->iocp;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// If the backend fd hasn't changed, don't proceed.
|
||||||
|
if (handle == handle_)
|
||||||
|
return;
|
||||||
|
|
||||||
|
handle_ = handle;
|
||||||
|
|
||||||
// Add dummy handle for libuv, otherwise libuv would quit when there is
|
// Add dummy handle for libuv, otherwise libuv would quit when there is
|
||||||
// nothing to do.
|
// nothing to do.
|
||||||
uv_async_init(uv_loop_, dummy_uv_handle_.get(), nullptr);
|
uv_async_init(uv_loop_, dummy_uv_handle_.get(), nullptr);
|
||||||
|
|
|
@ -159,6 +159,12 @@ class NodeBindings {
|
||||||
// Isolate data used in creating the environment
|
// Isolate data used in creating the environment
|
||||||
node::IsolateData* isolate_data_ = nullptr;
|
node::IsolateData* isolate_data_ = nullptr;
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
HANDLE handle_;
|
||||||
|
#else
|
||||||
|
int handle_ = -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
base::WeakPtrFactory<NodeBindings> weak_factory_{this};
|
base::WeakPtrFactory<NodeBindings> weak_factory_{this};
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(NodeBindings);
|
DISALLOW_COPY_AND_ASSIGN(NodeBindings);
|
||||||
|
|
|
@ -112,9 +112,8 @@ void ElectronRendererClient::DidCreateScriptContext(
|
||||||
bool should_load_node =
|
bool should_load_node =
|
||||||
(is_main_frame || is_devtools || allow_node_in_subframes) &&
|
(is_main_frame || is_devtools || allow_node_in_subframes) &&
|
||||||
!IsWebViewFrame(renderer_context, render_frame);
|
!IsWebViewFrame(renderer_context, render_frame);
|
||||||
if (!should_load_node) {
|
if (!should_load_node)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
injected_frames_.insert(render_frame);
|
injected_frames_.insert(render_frame);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue