diff options
| author | Frédéric van der Essen <fva@openerp.com> | 2012-10-10 11:55:09 +0200 |
|---|---|---|
| committer | Frédéric van der Essen <fva@openerp.com> | 2012-10-10 11:55:09 +0200 |
| commit | 9c71d984e6937cc598fc8da52bf353322acc03cf (patch) | |
| tree | ada960c2a9f245a7b8f714e2bc25e6ca719ad683 /addons/web/static/src/js/corelib.js | |
| parent | dfad511a559e851a8471e93cecc998131ee143f4 (diff) | |
[IMP] Class instanciations throws an error when you forgot to use the new operator
bzr revid: fva@openerp.com-20121010095509-ojvigsva4hblta7m
Diffstat (limited to 'addons/web/static/src/js/corelib.js')
| -rw-r--r-- | addons/web/static/src/js/corelib.js | 4 |
1 files changed, 4 insertions, 0 deletions
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); |
