net: change mime type deduction in Change URLRequestAsarJob (#12319)
This commit is contained in:
parent
e93c587b8e
commit
792837bd71
1 changed files with 15 additions and 4 deletions
|
@ -241,10 +241,21 @@ void URLRequestAsarJob::FetchMetaInfo(const base::FilePath& file_path,
|
||||||
meta_info->is_directory = file_info.is_directory;
|
meta_info->is_directory = file_info.is_directory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// On Windows GetMimeTypeFromFile() goes to the registry. Thus it should be
|
|
||||||
// done in WorkerPool.
|
// We use GetWellKnownMimeTypeFromExtension() to ensure that configurations
|
||||||
meta_info->mime_type_result =
|
// that may have been set by other programs on a user's machine don't affect
|
||||||
net::GetMimeTypeFromFile(file_path, &meta_info->mime_type);
|
// the mime type returned (in particular, JS should always be
|
||||||
|
// (application/javascript). See https://crbug.com/797712. Using an accurate
|
||||||
|
// mime type is necessary at least for modules and sw, which enforce strict
|
||||||
|
// mime type requirements.
|
||||||
|
// TODO(deepak1556): Revert this when sw support is removed for file scheme.
|
||||||
|
base::FilePath::StringType file_extension = file_path.Extension();
|
||||||
|
if (file_extension.empty()) {
|
||||||
|
meta_info->mime_type_result = false;
|
||||||
|
} else {
|
||||||
|
meta_info->mime_type_result = net::GetWellKnownMimeTypeFromExtension(
|
||||||
|
file_extension.substr(1), &meta_info->mime_type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void URLRequestAsarJob::DidFetchMetaInfo(const FileMetaInfo* meta_info) {
|
void URLRequestAsarJob::DidFetchMetaInfo(const FileMetaInfo* meta_info) {
|
||||||
|
|
Loading…
Reference in a new issue