Rely on OnDownloadDestroyed to destroy downloadItem
This commit is contained in:
parent
f624800881
commit
f1f91828ba
3 changed files with 4 additions and 18 deletions
|
@ -306,14 +306,12 @@ void Session::OnDownloadCreated(content::DownloadManager* manager,
|
|||
auto web_contents = item->GetWebContents();
|
||||
if (SavePageHandler::IsSavePageTypes(item->GetMimeType()))
|
||||
return;
|
||||
auto download_item_handle = DownloadItem::Create(isolate(), item);
|
||||
bool prevent_default = Emit(
|
||||
"will-download",
|
||||
download_item_handle,
|
||||
DownloadItem::Create(isolate(), item),
|
||||
api::WebContents::CreateFrom(isolate(), web_contents));
|
||||
if (prevent_default) {
|
||||
item->Cancel(true);
|
||||
download_item_handle->Destroy(item);
|
||||
item->Remove();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue