Fix loading node integration when page in webview navigates, close #1068
This commit is contained in:
parent
b51e2f6453
commit
2ed7d58ac4
1 changed files with 12 additions and 6 deletions
|
@ -40,6 +40,10 @@ bool IsSwitchEnabled(base::CommandLine* command_line,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsGuestFrame(blink::WebFrame* frame) {
|
||||||
|
return frame->uniqueName().utf8() == "ATOM_SHELL_GUEST_WEB_VIEW";
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
AtomRendererClient::AtomRendererClient()
|
AtomRendererClient::AtomRendererClient()
|
||||||
|
@ -102,12 +106,14 @@ void AtomRendererClient::DidCreateScriptContext(blink::WebFrame* frame,
|
||||||
v8::Handle<v8::Context> context,
|
v8::Handle<v8::Context> context,
|
||||||
int extension_group,
|
int extension_group,
|
||||||
int world_id) {
|
int world_id) {
|
||||||
// Only attach node bindings in main frame.
|
// Only attach node bindings in main frame or guest frame.
|
||||||
|
if (!IsGuestFrame(frame)) {
|
||||||
if (main_frame_)
|
if (main_frame_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// The first web frame is the main frame.
|
// The first web frame is the main frame.
|
||||||
main_frame_ = frame;
|
main_frame_ = frame;
|
||||||
|
}
|
||||||
|
|
||||||
// Give the node loop a run to make sure everything is ready.
|
// Give the node loop a run to make sure everything is ready.
|
||||||
node_bindings_->RunMessageLoop();
|
node_bindings_->RunMessageLoop();
|
||||||
|
@ -133,7 +139,7 @@ bool AtomRendererClient::ShouldFork(blink::WebFrame* frame,
|
||||||
bool is_server_redirect,
|
bool is_server_redirect,
|
||||||
bool* send_referrer) {
|
bool* send_referrer) {
|
||||||
// Never fork renderer process for guests.
|
// Never fork renderer process for guests.
|
||||||
if (frame->uniqueName().utf8() == "ATOM_SHELL_GUEST_WEB_VIEW")
|
if (IsGuestFrame(frame))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Handle all the navigations and reloads in browser.
|
// Handle all the navigations and reloads in browser.
|
||||||
|
|
Loading…
Reference in a new issue