Closed Bug 1410643 Opened 8 years ago Closed 6 years ago

Display an error in the console when a CSS file’s Content-Type is incorrect

Categories

(DevTools :: Console, enhancement)

58 Branch
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: bugs, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0 Build ID: 20171019100107 Steps to reproduce: - Serve a CSS file with a wrong Content-Type header, easiest way is to name it style.js or similar and have the web server use the default MIME type for this extension. - Serve an HTML file containing <link type="text/css" href="style.js"> Actual results: The stylesheet was rightfully not applied, but the web console didn’t display any error, the style tab displayed “0 rules” on the CSS file, the only hint was in the network tab where it is listed as “type js”. Expected results: An error should have been emitted into the web console, about mismatched Content-Type vs. expectation. I haven’t checked, but other foreign file inclusion mechanisms may have the same issue, whether non-JS files in <script/>, non-image files in <img/> or non-video files in <video/>.
Here is what I get for a JS file served with the wrong mimetype: > Loading failed for the <script> with source “https://foo.bar/baz”. Chromium's error message here is rather explicit: > Refused to execute script from 'https://foo.bar/baz' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. Mind you the error might be different depending on the type being served, I don't know.
Severity: normal → enhancement
Component: Untriaged → Developer Tools: Console
Product: Firefox → DevTools
Attached image CSS wrong mime type

We already have such message, it's under the CSS filter.

Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: