CEF version: Branch 2623 win32
OS: Windows 7 64bit
I embedded cef in my main application. To make all pages loaded in one browser I return true in OnBeforePopup functions. But when I clicked a https link and before OnLoadStart called I clicked another or the same link again, my program will generate a new unexpected window. This is my OnBeforePopup function:
- Code: Select all
bool BrowserHandler::OnBeforePopup(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& target_url,
const CefString& target_frame_name,
CefLifeSpanHandler::WindowOpenDisposition target_disposition,
bool user_gesture,
const CefPopupFeatures& popupFeatures,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings,
bool* no_javascript_access){
CEF_REQUIRE_IO_THREAD();
browser->GetMainFrame()->LoadURL(target_url);
return true;
}
The output log say in life_span_handler_ctocpp.cc Line 39 check failed which is in CefLifeSpanHandlerCToCpp::OnBeforePopup funciton:
- Code: Select all
DCHECK(frame.get());
if (!frame.get())
return false;
The first click will call my custom OnBeforePopup, but the second click will not call it. Instead it will return false in CefLifeSpanHandlerCToCpp::OnBeforePopup. I guess that's why new popup generated. But why the frame pointer will be empty? That's strange...Maybe LoadURL function will destroy the old frame???
How to solve it?