From 23d6609ed8cf7e10a1448d478fd6c899cc12b6b8 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 8 Mar 2022 11:40:25 -0800 Subject: [PATCH] fix: crash when showin item in folder on DevTools --- 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 e7c64bf957c32..2141c539230e4 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::TimeDelta::FromMilliseconds(250); constexpr base::TimeDelta kMaxBackoffDelay = base::TimeDelta::FromSeconds(10); @@ -738,9 +742,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,