Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not crash while saving file using an extension. #25702

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading