Is there any way to tell if frame->ExecuteJavascript (or something similar) was successful (i.e. the function is not undefined)?
My usecase is like this:
1. User tries to close the browser/window.
2. SimpleHandler::DoClose is called.
3. I call a onclose() function which triggers a dialog in javascript asking if he actually wants to close. It looks like this: frame->ExecuteJavaScript("onclose();", frame->GetURL(), 0);
4. When the user confirms a XMLHttpRequest is being send from JavaScript to CEF3 which I capture and close the window.
Everything works fine, the only issue occures when the javascript code is not available (i.e. if it is the DevTools window). Then there is no onclose() function to call nor any XMLHttpRequest functionality implemented.
The only two possible solutions I can think of are:
1. Find a way to check if the onclose() function is available (is not undefined) on the browser/JavaScript side. if not, close the window no matter what. (This is my prefered solution, yet ExecuteJavascript does not return anything since it is asynchronous)
2. Find a way to check (in SimpleHandler::DoClose) if the window that is going to be closed is the DevTools window and then just close it and ignore everything else. (This does not sound as such a good solution. Also I have no idea how one would correctly check if the window is the DevTools window.)