What steps will reproduce the problem?
1. run a box2dweb app on chrome
2. call (new Date).toLocaleTimeString();
3. (my test code is a bit more complex as it went through processing.js). I
think I know the solution, so haven't produced a particularly simple test case,
but can do if the problem remains
What is the expected output? What do you see instead?
(new Date).toLocaleTimeString(); produces an error:
Error: Internal error. Formatter and date value have to be specified.
Please provide any additional information below.
After hunting around a lot, I think this is because this code attempts to
redefine Object.defineProperty.
console.log(Object.defineProperty);
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);
}
}
It ought to only do it when it does not exist, but in recent Chrome,
defineProperty is a native function which seems not to appear in the prototype.
I think I have fixed it by adding a check against Object.defineProperty:
if((!(Object.prototype.defineProperty instanceof Function)
&& !(Object.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 marcogil...@gmail.com on 24 Jun 2013 at 9:31
Original issue reported on code.google.com by
marcogil...@gmail.com
on 24 Jun 2013 at 9:31Attachments: