Skip to content

Commit f2c8fe5

Browse files
committed
Fix frame argument of 'document-{start|end}' event
The frame object should be constructed in correct context, or the event handler may not be called when navigation happens due to the previous context is gone. Fix nwjs#2867
1 parent 1c21814 commit f2c8fe5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/api/dispatcher.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ void Dispatcher::documentCallback(const char* ev, blink::WebLocalFrame* frame) {
192192
blink::LocalFrame* core_frame = blink::toWebLocalFrameImpl(frame)->frame();
193193
if (core_frame->deprecatedLocalOwner()) {
194194
element = blink::toV8((blink::HTMLElement*)core_frame->deprecatedLocalOwner(),
195-
frame->mainWorldScriptContext()->Global(),
196-
frame->mainWorldScriptContext()->GetIsolate());
195+
web_view->mainFrame()->mainWorldScriptContext()->Global(),
196+
web_view->mainFrame()->mainWorldScriptContext()->GetIsolate());
197197
}
198198
args->Set(0, element);
199199
v8::Handle<v8::Value> argv[] = {val, v8_str(ev), args };

0 commit comments

Comments
 (0)