turbulenz / turbulenz_engine

Turbulenz is a modular 3D and 2D game framework for making HTML5 powered games for browsers, desktops and mobile devices.

Home Page:http://turbulenz.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ES6 TypedArray.prototype.map breaks some logic

bterlson opened this issue · comments

ES6 adds a map method to TypedArray.prototype and the latest IE TP implements this method while firefox is working on implementing it now. This causes problems with this line because Float32Array.prototype.map won't be undefined and the custom methods map, unmap, and setData won't be defined.

There are two possible fixes I can see: rename your custom map method to something that doesn't conflict, or a more local fix is that you can override the built-in map by checking Float32Array.hasOwnProperty('map') instead of Float32Array.prototype.map === undefined (the built-in map is defined on Float32Array.prototype.__proto__, the shared prototype of all the typed arrays, so you'd be overriding the built-in map only for Float32Array instances).

This is also breaking sites in Firefox now too: https://bugzilla.mozilla.org/show_bug.cgi?id=1167700#c5

We (Chrome) noticed that the website versions of games like Polycraft have been updated to fix the issue, but the Chrome App version, and the engine in this repository still does face the issue. What would it take to fix this bug in all places, so that the game doesn't break in versions of Chrome which include that function?

We've pushed out our fixes relating to this along with updated versions of apps which were breaking.

I'm still seeing this issue. I'm seeing the setdata is not defined error with the debug samples built from github source. Can someone confirm this bug fix against the current turbulenz repo?

I'm seeing this error in the debug versions of the animation samples and the forward rendering sample.