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: sync devtools frontend mime types with upstream #25780

Merged
merged 2 commits into from Oct 6, 2020
Merged
Changes from 1 commit
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
15 changes: 14 additions & 1 deletion shell/browser/ui/devtools_ui.cc
Expand Up @@ -22,7 +22,12 @@ namespace electron {
namespace {

std::string PathWithoutParams(const std::string& path) {
return GURL(std::string("devtools://devtools/") + path).path().substr(1);
return GURL(base::StrCat({content::kChromeDevToolsScheme,
url::kStandardSchemeSeparator,
chrome::kChromeUIDevToolsHost}))
.Resolve(path)
.path()
.substr(1);
}

std::string GetMimeTypeForPath(const std::string& path) {
Expand All @@ -33,11 +38,19 @@ std::string GetMimeTypeForPath(const std::string& path) {
base::CompareCase::INSENSITIVE_ASCII)) {
return "text/css";
} else if (base::EndsWith(filename, ".js",
base::CompareCase::INSENSITIVE_ASCII) ||
base::EndsWith(filename, ".mjs",
base::CompareCase::INSENSITIVE_ASCII)) {
return "application/javascript";
} else if (base::EndsWith(filename, ".png",
base::CompareCase::INSENSITIVE_ASCII)) {
return "image/png";
} else if (base::EndsWith(filename, ".map",
base::CompareCase::INSENSITIVE_ASCII)) {
return "application/json";
} else if (base::EndsWith(filename, ".ts",
base::CompareCase::INSENSITIVE_ASCII)) {
return "application/x-typescript";
} else if (base::EndsWith(filename, ".gif",
base::CompareCase::INSENSITIVE_ASCII)) {
return "image/gif";
Expand Down