fix(developer/ide): model debugger mime type mismatch

Fixes #2630.

The MIME type for .js was being read from the registry, which on some
systems has been corrupted to text/plain, which causes Chrome to abort
loading the script. The fix is to avoid loading the system registered
MIME types, which we don't need anyway, because all the MIME types we
are using are in the default hard-coded list.
This commit is contained in:
Marc Durdin 2020-02-11 20:10:22 +11:00
parent c3cff2f24d
commit a0001a7caa
2 changed files with 11 additions and 2 deletions

View file

@ -58,7 +58,11 @@ begin
Exit;
end;
AResponseInfo.ContentType := AResponseInfo.HTTPServer.MIMETable.GetFileMIMEType(AFileName);
if AResponseInfo.ContentType = '' then
begin
AResponseInfo.HTTPServer.MIMETable.LoadTypesFromOS := False;
AResponseInfo.ContentType := AResponseInfo.HTTPServer.MIMETable.GetFileMIMEType(AFileName);
end;
AResponseInfo.CharSet := 'UTF-8';
AResponseInfo.ContentLength := FileSizeByName(AFileName);
//AResponseInfo.LastModified := GetFileDate(doc);

View file

@ -652,6 +652,7 @@ begin
Delete(doc, 1, 6);
// Models always expire immediately
AResponseInfo.ContentType := 'application/javascript';
AResponseInfo.Expires := EncodeDate(1990, 1, 1); // I4037
AResponseInfo.CacheControl := 'no-cache, no-store'; // I4037
AResponseInfo.LastModified := Now; // I4037
@ -686,7 +687,11 @@ begin
// Serve the file
AResponseInfo.ContentType := AResponseInfo.HTTPServer.MIMETable.GetFileMIMEType(doc);
if AResponseInfo.ContentType = '' then
begin
AResponseInfo.HTTPServer.MIMETable.LoadTypesFromOS := False;
AResponseInfo.ContentType := AResponseInfo.HTTPServer.MIMETable.GetFileMIMEType(doc);
end;
AResponseInfo.CharSet := 'UTF-8';
AResponseInfo.ContentLength := FileSizeByName(doc);
//AResponseInfo.LastModified := GetFileDate(doc);