From 92cd3d1fa57a8d47496318694596c6fc5fd8eae7 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Wed, 9 Mar 2022 17:32:52 -0500 Subject: [PATCH] fix: crash when showin item in folder on DevTools (#33197) Co-authored-by: Shelley Vohr --- shell/browser/ui/inspectable_web_contents.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/shell/browser/ui/inspectable_web_contents.cc b/shell/browser/ui/inspectable_web_contents.cc index b7e939c35d45f..150b2fcba242c 100644 --- a/shell/browser/ui/inspectable_web_contents.cc +++ b/shell/browser/ui/inspectable_web_contents.cc @@ -175,6 +175,10 @@ GURL GetDevToolsURL(bool can_dock) { return GURL(url_string); } +void OnOpenItemComplete(const base::FilePath& path, const std::string& result) { + platform_util::ShowItemInFolder(path); +} + constexpr base::TimeDelta kInitialBackoffDelay = base::Milliseconds(250); constexpr base::TimeDelta kMaxBackoffDelay = base::Seconds(10); @@ -737,9 +741,8 @@ void InspectableWebContents::ShowItemInFolder( return; base::FilePath path = base::FilePath::FromUTF8Unsafe(file_system_path); - - // Pass empty callback here; we can ignore errors - platform_util::OpenPath(path, platform_util::OpenCallback()); + platform_util::OpenPath(path.DirName(), + base::BindOnce(&OnOpenItemComplete, path)); } void InspectableWebContents::SaveToFile(const std::string& url,