mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: workaround for hang when preventDefault-ing nativeWindowOpen (#22750)
* fix: enable workaround for nativeWindowOpen hang * add test * test: ensure window doesn't leak into other test * update to use new webcontents delegate methods Co-authored-by: Andy Locascio <andy@slack-corp.com>
This commit is contained in:
@@ -654,6 +654,30 @@ void WebContents::WebContentsCreated(content::WebContents* source_contents,
|
||||
tracker->frame_name = frame_name;
|
||||
}
|
||||
|
||||
bool WebContents::IsWebContentsCreationOverridden(
|
||||
content::SiteInstance* source_site_instance,
|
||||
content::mojom::WindowContainerType window_container_type,
|
||||
const GURL& opener_url,
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url) {
|
||||
if (Emit("-will-add-new-contents", target_url, frame_name)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
content::WebContents* WebContents::CreateCustomWebContents(
|
||||
content::RenderFrameHost* opener,
|
||||
content::SiteInstance* source_site_instance,
|
||||
bool is_new_browsing_instance,
|
||||
const GURL& opener_url,
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
content::SessionStorageNamespace* session_storage_namespace) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void WebContents::AddNewContents(
|
||||
content::WebContents* source,
|
||||
std::unique_ptr<content::WebContents> new_contents,
|
||||
|
||||
@@ -376,6 +376,21 @@ class WebContents : public gin_helper::TrackableObject<WebContents>,
|
||||
const base::string16& message,
|
||||
int32_t line_no,
|
||||
const base::string16& source_id) override;
|
||||
bool IsWebContentsCreationOverridden(
|
||||
content::SiteInstance* source_site_instance,
|
||||
content::mojom::WindowContainerType window_container_type,
|
||||
const GURL& opener_url,
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url) override;
|
||||
content::WebContents* CreateCustomWebContents(
|
||||
content::RenderFrameHost* opener,
|
||||
content::SiteInstance* source_site_instance,
|
||||
bool is_new_browsing_instance,
|
||||
const GURL& opener_url,
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
content::SessionStorageNamespace* session_storage_namespace) override;
|
||||
void WebContentsCreated(content::WebContents* source_contents,
|
||||
int opener_render_process_id,
|
||||
int opener_render_frame_id,
|
||||
|
||||
Reference in New Issue
Block a user