Box2D.js overwrite original Object.defineProperty
Opened this issue · 5 comments
GoogleCodeExporter commented
What steps will reproduce the problem?
1. Use Box2D.js latest browsers Chrome or Firefox (these browsers support
Object.defineProperty with full specification.
2. From javascript console type:
>> var obj = new Object();
>> Object.defineProperty(obj, "color", {value:'red'})
>> console.log(obj.color); => undefined
The output should be 'red' because these browsers support ecmascript-5
THE LINE OF BUG IS:
"Object.prototype.defineProperty instanceof Function"
THAT LINE SHOULD BE:
"Object.defineProperty instanceof Function"
WHY BUG?
to check if browser support defineProperty
if(!(Object.defineProperty instanceof Function))
HERE IS THE FULL BUG IN SOURCE CODE
if(!(Object.prototype.defineProperty instanceof Function)
&& Object.prototype.__defineGetter__ instanceof Function
&& Object.prototype.__defineSetter__ instanceof Function)
{
Object.defineProperty = function(obj, p, cfg) {
if(cfg.get instanceof Function)
obj.__defineGetter__(p, cfg.get);
if(cfg.set instanceof Function)
obj.__defineSetter__(p, cfg.set);
}
}
Original issue reported on code.google.com by damp...@gmail.com
on 27 Mar 2013 at 6:53
GoogleCodeExporter commented
Thank you SO SO SO MUCH!
This mystical problem just made me crazy!
Original comment by farid.ni...@gmail.com
on 30 Aug 2013 at 7:01
GoogleCodeExporter commented
This bug is realy critical, since it destroy native browser functionality. The
solution is already there and must be integrated as fast as possible.
Original comment by fbueckl...@gmail.com
on 30 Aug 2013 at 3:37
GoogleCodeExporter commented
+1 on integration. to find that one took 3h of my lifetime ... grzzz
Original comment by m...@19f.de
on 30 Aug 2013 at 3:39
GoogleCodeExporter commented
This sucked away an entire afternoon truing to hook up QUnit. It uses
String.localeCompare(). This bug causes that function to raise an "Illegal
access" exception. Very hard to debug.
Original comment by dave.spr...@gmail.com
on 24 Mar 2014 at 12:48
GoogleCodeExporter commented
Huge bug.
Breaks any ES6/ES2015 compilation of classes.
Original comment by monte...@gmail.com
on 12 May 2015 at 5:01