mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add notification for aborted popups (fixes #3776)
Pass a new |popup_id| parameter to OnBeforePopup and call a new OnBeforePopupAborted callback if the popup is aborted before OnAfterCreated is called for the popup browser. Add new CefBrowserHost::GetBrowserByIdentifier and GetOpenerIdentifier methods to assist with retrieval of associated browsers. In cefclient, clean up state when a popup is aborted and close any associated popup browsers when the opener browser is closed. This also works when running with `--use-default-popup`.
This commit is contained in:
@@ -412,6 +412,11 @@ struct FrameStatus {
|
||||
EXPECT_FALSE(browser->IsValid()) << func;
|
||||
}
|
||||
|
||||
const auto browser_id = browser->GetIdentifier();
|
||||
EXPECT_GT(browser_id, 0) << func;
|
||||
auto get_browser = CefBrowserHost::GetBrowserByIdentifier(browser_id);
|
||||
EXPECT_TRUE(get_browser && get_browser->IsSame(browser)) << func;
|
||||
|
||||
// Note that this might not be the same main frame as us when navigating
|
||||
// cross-origin, because the new main frame object is assigned to the
|
||||
// browser before the CefFrameHandler callbacks related to main frame change
|
||||
@@ -1641,6 +1646,7 @@ class ParentOrderMainTestHandler : public OrderMainTestHandler {
|
||||
bool OnBeforePopup(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int popup_id,
|
||||
const CefString& target_url,
|
||||
const CefString& target_frame_name,
|
||||
CefLifeSpanHandler::WindowOpenDisposition target_disposition,
|
||||
|
Reference in New Issue
Block a user