Closed Bug 838521 Opened 7 years ago Closed 2 years ago

scripts with unsupported types are requested and downloaded (spec violation)

Categories

(Core :: DOM: Core & HTML, defect)

18 Branch
x86
Windows XP
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla60
Tracking Status
firefox60 --- fixed

People

(Reporter: bugzilla, Assigned: bzbarsky)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0
Build ID: 20130116073211

Steps to reproduce:

I referenced an unsupported type of script like this:

<script type="application/nop" src="requesting-this-file-is-a-spec-violation.nop"></script>

Test case: http://kaioa.com/k/test/script-test-case/index.html


Actual results:

Firefox 18 downloaded the referenced file even though it doesn't know what to do with it.

(Firefox 18 did not execute the script. This part worked fine.)


Expected results:

Since Firefox does not know how to handle "application/nop" scripts, it must not download them.

http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#the-script-element

The process should stop at step 7 (way before the download starts):

"If the user agent does not support the scripting language given by the script block's type for this script element, then the user agent must abort these steps at this point. The script is not executed."
Component: Untriaged → HTML: Parser
Product: Firefox → Core
Assignee: nobody → hsivonen
Looks like Chrome (going back to at least version 37, which is the oldest I can get my hands on) and Safari do not download in this situation.  I guess we might as well do the same.
Assignee: hsivonen → bzbarsky
Status: UNCONFIRMED → NEW
Component: HTML: Parser → DOM
Ever confirmed: true
I guess this only happens for script preloads, because ScriptLoader::ProcessScriptElement does bail out immediately on type mismatch.
MozReview-Commit-ID: JWiKNElENyZ
Attachment #8950950 - Flags: review?(amarchesini)
Attachment #8950950 - Flags: review?(amarchesini) → review+
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d60680f8627c
Don't preload scripts of unknown type, just like we don't load them normally.  r=baku
https://hg.mozilla.org/mozilla-central/rev/d60680f8627c
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.