[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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user