Open Bug 244013 Opened 21 years ago Updated 2 years ago

No warning given for incorrect mime types in script tag

Categories

(DevTools :: Console, defect, P5)

x86
Windows XP
defect

Tracking

(Not tracked)

People

(Reporter: bazkar, Unassigned)

Details

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8 When encountering a script tag in an incorrectly formatted MIME format, the browser just skips the script block without bringing up any message, warning or error in the console. This might come in very handy when debugging a page that for instance has: <script type="text\javascript">...</script> instead of: <script type="text/javascript">...</script> Reproducible: Always Steps to Reproduce: 1. 2. 3. Expected Results: A warning (at least) in the console stating an incorrectly formatted MIME format in a script tag.
Assignee: firefox → parser
Component: General → HTML: Parser
Product: Firefox → Browser
Version: unspecified → Trunk
Status: UNCONFIRMED → NEW
Ever confirmed: true
This isn't handled in the HTML parser, and I don't think we should warn -- there's a LOT of vbscript out there and we would be warning on all of it.
Assignee: parser → general
Component: HTML: Parser → DOM
QA Contact: ian
There's also the issue that no one can figure out what the correct MIME-type for Javascript should be, and actually trying to deploy the correct MIME-type would probably break things.
(In reply to comment #2) > There's also the issue that no one can figure out what the correct MIME-type for > Javascript should be, and actually trying to deploy the correct MIME-type would > probably break things. Maybe I should have stated my problem more clear. Althought the correct MIME type for Javascript is not defined clearly (mostly being either text/javascript or application/x-javascript), the syntax for defining MIME-types IS clearly defined (see: http://www.ietf.org/rfc/rfc2046.txt). So a warning can indeed be generated if a MIME-type is encountered that is not properly formatted. Mozilla does parse some aspect of the MIME type of a script tag as to known whether it should execute the code within the script. It shouldn't be that hard to generate a warning based on that parse when an incorrectly formatted MIME type is encountered. One cannot ofcourse generate warnings on all -not recognised or not executable MIME types- (such as text/vbscript as pointed out by Mr. Zbarsky) but MIME types that are simply not allowed can be warned about. From http://www.ietf.org/rfc/rfc2046.txt: The five discrete top-level media types are: text, image, audio, video, application. The two composite top-level media types are: multipart, message. Although no implications can be made about which types a script may or may not contain (ok, audio would seem really strange), a statement can be made about the MIME type foo+bar for instance to be false (since foo+bar is not one of the above mentioned allowed types and the syntax type/subtype is violated) and thus a warning can be generated.
> Mozilla does parse some aspect of the MIME type of a script tag Not really. It just does a straight case-insensitive compare of the part before the ';' (if any) against each of the types we know we support; if it does not match any of them we don't look at it. So in fact, to do the sort of warning you want we'd need to write not only the warning code but the parsing code. Is it doable? Yes. Is it worth the code complexity? Probably not.
Assignee: general → nobody
QA Contact: ian → general
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven't been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML

I'll let DevTools consider this, but I tend to agree that this would become quite noisy, especially with the practice of using <script> for non-script things due to how it parsers.

Component: DOM: Core & HTML → Console
Product: Core → DevTools
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.