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

fix: crash when showing item in folder on DevTools #33197

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

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