{"action":"created","issue":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/9826","repository_url":"https://api.github.com/repos/mrdoob/three.js","labels_url":"https://api.github.com/repos/mrdoob/three.js/issues/9826/labels{/name}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/9826/comments","events_url":"https://api.github.com/repos/mrdoob/three.js/issues/9826/events","html_url":"https://github.com/mrdoob/three.js/issues/9826","id":181277518,"number":9826,"title":"Use of blob responseType in ImageLoader.","user":{"login":"jee7","id":3455815,"avatar_url":"https://avatars.githubusercontent.com/u/3455815?v=3","gravatar_id":"","url":"https://api.github.com/users/jee7","html_url":"https://github.com/jee7","followers_url":"https://api.github.com/users/jee7/followers","following_url":"https://api.github.com/users/jee7/following{/other_user}","gists_url":"https://api.github.com/users/jee7/gists{/gist_id}","starred_url":"https://api.github.com/users/jee7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jee7/subscriptions","organizations_url":"https://api.github.com/users/jee7/orgs","repos_url":"https://api.github.com/users/jee7/repos","events_url":"https://api.github.com/users/jee7/events{/privacy}","received_events_url":"https://api.github.com/users/jee7/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-05T22:02:53Z","updated_at":"2016-10-09T13:07:34Z","closed_at":null,"body":"##### Description of the problem \r\n\r\nThe `ImageLoader` sets the response type of `XHRLoader` to `blob`. This causes a problem with Chrome (53.0.2785.116 m) and running the script from the local filesystem, while fetching textures from a web server. It seems to me that this is a security consideration of Chrome. The closest info I found is [this](https://bugs.chromium.org/p/chromium/issues/detail?id=91136), but that does not seem exactly about that. In Firefox (49.0.1) there is no issue. \r\n\r\nFor me this functionality is important, because I'm using Three.js to teach CG and the students should not worry about web servers. Also I'd guess there are people, who want to prototype some things with Three.js and not set up a web server to do that.\r\n\r\nI made the `responseType` to be a parameter of the `ImageLoader` (and the `TextureLoader`) and with `arraybuffer` type there is no problem: [see image](http://tume-maailm.pri.ee/ylikool/ComputerGraphics-2015/other/uv-test/textureLoadingProblem-1.png). \r\nThe top row uses the r80 implementation with `blob` and the bottom row uses `arraybuffer` response type. With the `arraybuffer` I base64 encode it and set it as a data URL to the image.\r\n\r\nYou can also see that actually the `arraybuffer` seems a lot faster then the `blob` implementation. This seems to be that for some reason Chrome knows how to cache the former, but not the latter.\r\nIf the script is in a web server: [see image](http://tume-maailm.pri.ee/ylikool/ComputerGraphics-2015/other/uv-test/textureLoadingProblem-2.png). \r\nWith no caching the `arraybuffer` seems marginally faster with the texture I used: [see image](http://tume-maailm.pri.ee/ylikool/ComputerGraphics-2015/other/uv-test/textureLoadingProblem-3.png).\r\n\r\n\r\nLive example (download the file, the modified lib and open it from the local filesystem to see errors):\r\nhttp://tume-maailm.pri.ee/ylikool/ComputerGraphics-2015/other/uv-test/index-loadingTest.html\r\nThe no-cache version:\r\nhttp://tume-maailm.pri.ee/ylikool/ComputerGraphics-2015/other/uv-test/index-loadingTest-noCache.html\r\n\r\nI did this with r80, but r81 seems to have the same issue.\r\n\r\nShould I create a fork and PR with the `responseType` as a configurable value of the `TextureLoader` and `ImageLoader`?\r\n\r\nMight also be related to #9824, as, like I noticed, the request with `blob` response type does not cache the response in Chrome. So it will send new requests until the first one gets back and Three.js' own cache kicks in (maybe?).\r\n\r\n##### Three.js version\r\n\r\n- [ ] Dev\r\n- [ ] r81\r\n- [x] r80\r\n\r\n##### Browser\r\n\r\n- [ ] All of them\r\n- [x] Chrome\r\n- [ ] Firefox\r\n- [ ] Internet Explorer\r\n\r\n##### OS\r\n\r\n- [ ] All of them\r\n- [x] Windows\r\n- [ ] Linux\r\n- [ ] Android\r\n- [ ] IOS\r\n\r\n##### Hardware Requirements (graphics card, VR Device, ...)\r\nNo special requirements.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/comments/252485467","html_url":"https://github.com/mrdoob/three.js/issues/9826#issuecomment-252485467","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/9826","id":252485467,"user":{"login":"jee7","id":3455815,"avatar_url":"https://avatars.githubusercontent.com/u/3455815?v=3","gravatar_id":"","url":"https://api.github.com/users/jee7","html_url":"https://github.com/jee7","followers_url":"https://api.github.com/users/jee7/followers","following_url":"https://api.github.com/users/jee7/following{/other_user}","gists_url":"https://api.github.com/users/jee7/gists{/gist_id}","starred_url":"https://api.github.com/users/jee7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jee7/subscriptions","organizations_url":"https://api.github.com/users/jee7/orgs","repos_url":"https://api.github.com/users/jee7/repos","events_url":"https://api.github.com/users/jee7/events{/privacy}","received_events_url":"https://api.github.com/users/jee7/received_events","type":"User","site_admin":false},"created_at":"2016-10-09T13:07:34Z","updated_at":"2016-10-09T13:07:34Z","body":"> The Image/Texture loader works using a blob for onProgress events\r\nI tried the `onProgress` events and they seemed to work with `arraybuffer` as well."}}
{"actor":{"display_login":"jee7"}}