failed to call ExecuteJavascript() in OnContextMenuCommand

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

failed to call ExecuteJavascript() in OnContextMenuCommand

Postby justinkcyu » Tue Oct 28, 2014 2:38 am

I am new to CEF. I got a problem that I failed to call ExecuteJavascript() in OnContextMenuCommand in client_handler.cpp.

I try to popup an url after I select a menu from context menu, and it crashes at the new popup window:
browser->GetMainFrame()->ExecuteJavaScript("window.open(\"http://www.google.com\");", "about:blank", 0);

don't know why it works in RunPopupTest() of cefclient.cpp which uses a main menu in main window, or other functions like OnPreKeyEvent() or OnBeforeContextMenu() in client_handler.cpp

Thanks,
-Justin

PS. I am using Linux CEF 3.2062.1856.
justinkcyu
Newbie
 
Posts: 4
Joined: Tue Oct 28, 2014 2:27 am

Re: failed to call ExecuteJavascript() in OnContextMenuComma

Postby magreenblatt » Tue Oct 28, 2014 8:57 am

What is the back trace of the crash?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: failed to call ExecuteJavascript() in OnContextMenuComma

Postby justinkcyu » Tue Oct 28, 2014 1:10 pm

also It sometimes doesn't crash. The only change at the codes is I added the ExecuteJavaScrpt open.window right after "case CLIENT_ID_SHOW_DEVTOOLS:" in client_handler.cpp and commented out ShowDevTools(browser);

this is the back track using debug version:

--------popup target_url: http://www.google.com/, target_frame_name:
The program 'cefclient' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
(Details: serial 1619 error_code 3 request_code 3 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
[1028/104805:FATAL:context.cc(183)] Check failed: false. context not valid
#0 0x7fa6861fab21 base::debug::StackTrace::StackTrace()
#1 0x7fa686272a3f logging::LogMessage::~LogMessage()
#2 0x7fa686027326 CefQuitMessageLoop()
#3 0x7fa685f4d784 cef_quit_message_loop
#4 0x00000047364f CefQuitMessageLoop()
#5 0x00000044188a AppQuitMessageLoop()
#6 0x00000042253b ClientHandler::OnBeforeClose()
#7 0x0000004a4d62 life_span_handler_on_before_close()
#8 0x7fa685f90131 CefLifeSpanHandlerCToCpp::OnBeforeClose()
#9 0x7fa685fd874f CefBrowserHostImpl::DestroyBrowser()
#10 0x7fa68601be59 CefContentBrowserClient::DestroyAllBrowsers()
#11 0x7fa6860281d5 CefContext::FinishShutdownOnUIThread()
#12 0x7fa686027d5d CefContext::Shutdown()
#13 0x7fa686026a49 (anonymous namespace)::CefForceShutdown::~CefForceShutdown()
#14 0x7fa68091c4da __cxa_finalize
#15 0x7fa685f4aad6 <unknown>

Aborted (core dumped)


PS. I just tried this at 3.2062.1803 of windows 64 version, it doesn't crash...
justinkcyu
Newbie
 
Posts: 4
Joined: Tue Oct 28, 2014 2:27 am

Re: failed to call ExecuteJavascript() in OnContextMenuComma

Postby magreenblatt » Tue Oct 28, 2014 1:23 pm

Does your application install error handlers as discussed in https://code.google.com/p/chromiumembed ... il?id=1337?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: failed to call ExecuteJavascript() in OnContextMenuComma

Postby justinkcyu » Tue Oct 28, 2014 1:33 pm

ya, the version I'm using has XErrorHandlerImpl and XIOErrorHandlerImpl in cefclient_gtk.cpp
justinkcyu
Newbie
 
Posts: 4
Joined: Tue Oct 28, 2014 2:27 am

Re: failed to call ExecuteJavascript() in OnContextMenuComma

Postby justinkcyu » Tue Oct 28, 2014 1:56 pm

I just tried the latest 3.2062.1898 (Branch 2062).
It seems this problem is gone.

thanks!
justinkcyu
Newbie
 
Posts: 4
Joined: Tue Oct 28, 2014 2:27 am


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 21 guests