englercj / resource-loader

A middleware-style generic resource loader built with web games in mind.
http://englercj.github.io/resource-loader/
MIT License
424 stars 77 forks source link

Chrome Mobile Incognito Error #134

Closed kane-mason closed 4 years ago

kane-mason commented 5 years ago

When using Chromes mobile app in an incognito tab on an Android device (Galaxy S8, Android 7.0, Chrome 75.0.3770) after enough requests for a resource, it will throw an Error with code 0.

I did some investigation myself and could reproduce the defect in isolation, the code can be found here (https://codepen.io/kanemason/pen/xvgPXr)

I then tried to dig a bit deeper and the offending line of code is setting the responseType property of the xhr object. It should be noted i only tested responseType = 'blob'. I created this pen to mimic what the resource-loader is doing internally (https://codepen.io/kanemason/pen/QedmyR), if you comment out the line where the responseType is set everything works fine.

Furthermore the issue seems to be far worse for the .ogg filetype, if you switch the resource url to .mp3 or .m4a, the error is far less frequent. I have also logged a bug with Chromium team: https://bugs.chromium.org/p/chromium/issues/detail?id=988429

englercj commented 4 years ago

Looks like this is a bug in the Chrome browser and I'm not sure what mitigation we can do here to alleviate the problem, but remain correct.

You might be able to use arraybuffer or another binary response type in your own code to get around it though.