Re: [Bug 6684] Disregard of RFC 4329 and IANA MIME Media Types

Julian Reschke wrote:
> Q: do we have information about whether the type attribute is honored 
> for external scripts?

The Gecko code for @type on <script> is something like this, in pseudocode:

if (@type not set or empty) {
   if (@language not set or empty) {
     // Treat as default script language; what this is depends on the
     // content-script-type HTTP header or equivalent META tag
   } else {
     if (@language is one of "javascript", "livescript", "mocha",
                             "javascript1.0", "javascript1.1",
                             "javascript1.2", "javascript1.3",
                             "javascript1.4", "javascript1.5",
                             "javascript1.6", "javascript1.7",
                             "javascript1.8") {
       // Treat as javascript
     } else {
       // Treat as unknown script language; do not execute
     }
   }
} else {
   if (@type is one of "text/javascript", "text/ecmascript",
                       "application/javascript",
                       "application/ecmascript",
                       "application/x-javascript") {
     // Treat as javascript
   } else {
     // Treat as specified (e.g. if pyxpcom is installed and
     // python script is allowed in this context and the type
     // is one that the python runtime claims to handle, use that).
     // If we don't have a runtime for this type, do not execute.
   }
}

There is no difference between inline and internal scripts at this 
stage; this code executes for all <html:script> and <svg:script> 
elements.  <xul:script> might have other weirdness associated with it, 
but I don't think that should affect the HTML specification.

-Boris

Received on Monday, 20 April 2009 16:11:04 UTC