From 9c71d984e6937cc598fc8da52bf353322acc03cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Wed, 10 Oct 2012 11:55:09 +0200 Subject: [PATCH] [IMP] Class instanciations throws an error when you forgot to use the new operator bzr revid: fva@openerp.com-20121010095509-ojvigsva4hblta7m --- addons/web/static/src/js/corelib.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/web/static/src/js/corelib.js b/addons/web/static/src/js/corelib.js index ff193605033..21d593069e7 100644 --- a/addons/web/static/src/js/corelib.js +++ b/addons/web/static/src/js/corelib.js @@ -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);