You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

33 lines
632 B

/*
* Bug reported by http://www.reddit.com/user/judofyr:
*
* This raises an error (because the bound function is not constructable).
* According to MDC this should work:
*
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind#Bound_functions_used_as_constructors
*
* (and I believe there's code out there that depends on it).
*/
/*===
object
1
===*/
function Thing(value) {
print(typeof this);
this.value = value;
}
function test() {
one = Thing.bind(null, 1);
var obj = new one;
print(obj.value);
}
try {
test();
} catch (e) {
print(e);
}