Skip to content

Commit

Permalink
fix: crash when showin item in folder on DevTools (#33197)
Browse files Browse the repository at this point in the history
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
  • Loading branch information
trop[bot] and codebytere committed Mar 9, 2022
1 parent 47f8a13 commit 92cd3d1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions shell/browser/ui/inspectable_web_contents.cc
Expand Up @@ -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);

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 92cd3d1

Please sign in to comment.