[audioworklet] Can't load "data:" urls with mimetype application/javascript
Reported by
shakt...@gmail.com,
Jan 30 2018
|
||||||
Issue descriptionChrome Version : 64.0.3282.119 (Official Build) (64-bit) What steps will reproduce the problem? (1) Enable AudioWorklets in Chrome (https://developers.google.com/web/updates/2017/12/audio-worklet#experimental) (2) Load the attached file, audioworklet_test_application_javascript.html (3) Listen for noise, check the console. What is the expected result? It should generate noise through the speakers. What happens instead? It generates an alert in the console: "Uncaught (in promise) DOMException: the user aborted a request." Tested on Mac Chrome and Linux Chrome. Please provide any additional information below. Attach a screenshot if possible. The same test works if you change the MIME Type of the data URL from application/javascript to text/javascript. Both MIME Types work with "blob:" urls generated from URL.createObjectURL.
,
Jan 30 2018
,
Jan 31 2018
+kouhei@: Does the module loader support "data:" urls with "application/javascript"? I'd like to identify if this is an issue in the worklet side or the module loader side before spending time on debugging.
,
Jan 31 2018
hiroshige: Would you triage this? Sorry I'm too busy today
,
Jan 31 2018
Module loader's MIME check refers https://codesearch.chromium.org/chromium/src/third_party/WebKit/common/mime_util/mime_util.cc?gsn=IsSupportedJavaScriptMIMEType&l=42 and "application/javascript" is listed there as well as "text/javascript". So I expect the MIME type check passes in module script side.
,
Jan 31 2018
passing the ball back to nhiroki
,
Jan 31 2018
Thank you for the quick reply! :)
,
Feb 2 2018
It seems whitespaces in data URL response are stripped if the MIME type is application/javascript.
fetch('data:application/javascript,foo bar').then(r => r.text()).then(r => console.log(r));
=> foobar
fetch('data:text/javascript,foo bar').then(r => r.text()).then(r => console.log(r));
=> foo bar
So not related to modules or worklets.
,
Feb 2 2018
The same result on Firefox > fetches in Comment #8. Due to the whitespace stripping, a parse error occurs and thus the worklet fails. According to: https://tools.ietf.org/html/rfc2397 https://en.wikipedia.org/wiki/Data_URI_scheme https://codesearch.chromium.org/chromium/src/net/base/data_url.cc?type=cs&l=93 Whitespaces in data URL are not allowed and should be escaped instead, and Chromium seems to intentionally strip them (except for text/ and xml types). |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by hongchan@chromium.org
, Jan 30 2018Components: Blink>Workers
Status: Available (was: Unconfirmed)