Skip to content

Commit

Permalink
Merge pull request #1119 from yren93/add-mime-types-for-devtools
Browse files Browse the repository at this point in the history
Electron had similar issue in its devtools: electron/electron#27103. Electron fixed the issue by adapting changes from Chromium upstream: electron/electron#25780. This PR also adapted upstream changes for adding more mime types support.
  • Loading branch information
inseob authored and GitHub Enterprise committed May 19, 2021
2 parents 1df3fb0 + 0490e39 commit 09b6559
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/content/browser/devtools/devtools_http_handler.cc
Expand Up @@ -416,6 +416,22 @@ static std::string GetMimeType(const std::string& filename) {
base::CompareCase::INSENSITIVE_ASCII)) {
return "image/svg+xml";
}

// blpwtk2: adapted from chrome/browser/ui/webui/devtools_ui_data_source.cc
else if (base::EndsWith(filename, ".mjs",
base::CompareCase::INSENSITIVE_ASCII)) {
return "application/javascript";
} 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, ".manifest",
base::CompareCase::INSENSITIVE_ASCII)) {
return "text/cache-manifest";
}

LOG(ERROR) << "GetMimeType doesn't know mime type for: "
<< filename
<< " text/plain will be returned";
Expand Down

0 comments on commit 09b6559

Please sign in to comment.