Skip to content

Commit 90fbc15

Browse files
committed
Fix nwjs#7125: nw.Window not working after navigation
1 parent 2723a99 commit 90fbc15

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/renderer/nw_extensions_renderer_hooks.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,9 @@ void DocumentHook2(bool start, content::RenderFrame* frame, Dispatcher* dispatch
455455
extensions::ModuleSystem::NativesEnabledScope natives_enabled(script_context->module_system());
456456
extensions::NativeExtensionBindingsSystem* binding_sys = (extensions::NativeExtensionBindingsSystem*)dispatcher->bindings_system();
457457
v8_context->Enter();
458-
binding_sys->GetAPIObjectForTesting(script_context, "nw.Window");
458+
v8::Local<v8::Object> nw_win = binding_sys->GetAPIObjectForTesting(script_context, "nw.Window");
459+
if (nw_win.IsEmpty())
460+
binding_sys->GetAPIObjectForTesting(script_context, "nw.Window", true);
459461
v8_context->Exit();
460462
script_context->module_system()->CallModuleMethodSafe("nw.Window", "onDocumentStartEnd", &arguments);
461463
}

0 commit comments

Comments
 (0)