Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Box2D.js overwrite original Object.defineProperty #41

Open
GoogleCodeExporter opened this issue Aug 24, 2015 · 5 comments
Open

Box2D.js overwrite original Object.defineProperty #41

GoogleCodeExporter opened this issue Aug 24, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

+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
Copy link
Author

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
Copy link
Author

Huge bug.

Breaks any ES6/ES2015 compilation of classes.

Original comment by monte...@gmail.com on 12 May 2015 at 5:01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant