Hey everyone !
The brand new iOS 10 update fracking sucks to load BJS cube textures.
I've already had noticed this problem several month ago (on iOS 9) but it happened only very occasionnaly (and pretty randomly). But now, since iOS 10, I don't know what Apple has changed but the bug is happening at least 9 times out of 10, in every mobile browser on iOS.
What the bug is exactly ? When a cube texture is loaded, the cascadeLoad call in Engine.createCubeTexture bugs in the callback for-loop :
for (var index = 0; index < faces.length; index++) {
_this._workingContext.drawImage(imgs[index], 0, 0, imgs[index].width, imgs[index].height, 0, 0, width, height);
gl.texImage2D(faces[index], 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, _this._workingCanvas);
}
The code stops in one of the loops claiming that imgs[index] is undefined. The faulty loop iteration number is randomly changing, sometimes the third, sometimes the fourth, sometimes another one... it probably depends how quick the cube images files are loaded.
The bug happens retroactively from BJS 2.5 to (at least) BJS 2.1.
And now, the cherry on the cake: the bug never occur if the browser is in private browsing mode. As if the caching process of the images is responsible of a kind of loading delay or something like that...