[IMP] Class instanciations throws an error when you forgot to use the new operator

bzr revid: fva@openerp.com-20121010095509-ojvigsva4hblta7m
This commit is contained in:
Frédéric van der Essen
2012-10-10 11:55:09 +02:00
parent dfad511a55
commit 9c71d984e6
+4
View File
@@ -121,6 +121,10 @@ openerp.web.corelib = function(instance) {
// The dummy class constructor
function Class() {
if(this.constructor !== instance.web.Class){
throw new Error("You need a 'new' to instanciate an object");
return null;
}
// All construction is actually done in the init method
if (!initializing && this.init) {
var ret = this.init.apply(this, arguments);