[FIX] web: utils: patch: restore _super

Before this rev., this._super wasn't correctly reset after being
called. It means that it was sometimes wrongly set, for instance
in the following scenario:

utils.patch(SomeComponent, {
  x: function () {
    this.y();
    this._super(...arguments); // this._super was still y
  },
  y: function () {
    this._super(...arguments);
  },
});

closes odoo/odoo#41691

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Aaron Bohy
2019-12-12 13:34:48 +00:00
committed by Géry Debongnie
parent fc0f22f9b9
commit 3aee5a4cb4
+4 -1
View File
@@ -549,8 +549,11 @@ var utils = {
metadata.origMethods[methodName] = original;
}
proto[methodName] = function (...args) {
const previousSuper = this._super;
this._super = original;
return method.call(this, ...args);
const res = method.call(this, ...args);
this._super = previousSuper;
return res;
};
}
});