99#include < utility>
1010
1111#include " base/memory/ref_counted_memory.h"
12+ #include " base/strings/strcat.h"
1213#include " base/strings/string_util.h"
1314#include " base/strings/stringprintf.h"
1415#include " chrome/common/webui_url_constants.h"
@@ -22,7 +23,12 @@ namespace electron {
2223namespace {
2324
2425std::string PathWithoutParams (const std::string& path) {
25- return GURL (std::string (" devtools://devtools/" ) + path).path ().substr (1 );
26+ return GURL (base::StrCat ({content::kChromeDevToolsScheme ,
27+ url::kStandardSchemeSeparator ,
28+ chrome::kChromeUIDevToolsHost }))
29+ .Resolve (path)
30+ .path ()
31+ .substr (1 );
2632}
2733
2834std::string GetMimeTypeForPath (const std::string& path) {
@@ -33,11 +39,19 @@ std::string GetMimeTypeForPath(const std::string& path) {
3339 base::CompareCase::INSENSITIVE_ASCII)) {
3440 return " text/css" ;
3541 } else if (base::EndsWith (filename, " .js" ,
42+ base::CompareCase::INSENSITIVE_ASCII) ||
43+ base::EndsWith (filename, " .mjs" ,
3644 base::CompareCase::INSENSITIVE_ASCII)) {
3745 return " application/javascript" ;
3846 } else if (base::EndsWith (filename, " .png" ,
3947 base::CompareCase::INSENSITIVE_ASCII)) {
4048 return " image/png" ;
49+ } else if (base::EndsWith (filename, " .map" ,
50+ base::CompareCase::INSENSITIVE_ASCII)) {
51+ return " application/json" ;
52+ } else if (base::EndsWith (filename, " .ts" ,
53+ base::CompareCase::INSENSITIVE_ASCII)) {
54+ return " application/x-typescript" ;
4155 } else if (base::EndsWith (filename, " .gif" ,
4256 base::CompareCase::INSENSITIVE_ASCII)) {
4357 return " image/gif" ;
0 commit comments