Skip to content

Commit

Permalink
Do not crash while saving file using an extension. (uplift to 1.70.x) (
Browse files Browse the repository at this point in the history
…#25705)

Uplift of #25702 (squashed) to release
  • Loading branch information
brave-builds authored Sep 25, 2024
1 parent 28bed0a commit b5c1489
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion browser/ui/brave_browser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void BraveBrowser::RunFileChooser(
// something doesn't reach here. They show 'select file dialog' from
// DownloadFilePicker::DownloadFilePicker directly.
// https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/public/mojom/choosers/file_chooser.mojom;l=27;drc=047c7dc4ee1ce908d7fea38ca063fa2f80f92c77

CHECK(render_frame_host);
new_params->title = brave::GetFileSelectTitle(
content::WebContents::FromRenderFrameHost(render_frame_host),
render_frame_host->GetLastCommittedOrigin(),
Expand Down
1 change: 1 addition & 0 deletions browser/ui/brave_file_select_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ std::u16string GetFileSelectTitle(content::WebContents* web_contents,
// TODO(sko) It's hard to test this behavior is in sync at this moment. Even
// upstream tests aren't covering this. Need to figure out how we can test
// extension and isolated web app case.
CHECK(web_contents);
Profile* profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());

Expand Down
3 changes: 3 additions & 0 deletions chromium_src/chrome/browser/download/download_file_picker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ std::u16string GetTitle(content::RenderFrameHost* render_frame_host,
#if BUILDFLAG(IS_ANDROID)
return original_title;
#else
if (!render_frame_host) {
return original_title;
}
return brave::GetFileSelectTitle(
content::WebContents::FromRenderFrameHost(render_frame_host),
render_frame_host->GetLastCommittedOrigin(),
Expand Down

0 comments on commit b5c1489

Please sign in to comment.