[FIX] web: add fallback to Object.hasOwn in patch function

The patch function was changed at commit [1]. This introduced a call to
`Object.hasOwn` which is the preferred way to check if an Object has a
property as its own. However, after multiple user reports, it seems like
a significant amount of user and website visitors still use browsers
that do not have Object.hasOwn implemented.

This commit adds a polyfill to add Obejct.hasOwn in case it is not
found.

[1]: https://github.com/odoo/odoo/commit/04fddc19d4aedd8105e0fda5582288c2bb1833fe

Fixes https://github.com/odoo/odoo/issues/142022

opw-3824593

Part-of: odoo/odoo#160758
This commit is contained in:
Arthur Detroux (ard)
2024-04-12 18:14:53 +00:00
parent d132cea05f
commit b00ec7eb79
2 changed files with 4 additions and 0 deletions
+1
View File
@@ -123,6 +123,7 @@ This module provides the core of the Odoo Web Client.
'web/static/src/start.js',
],
'web.assets_frontend_minimal': [
'web/static/src/polyfills/object.js',
'web/static/src/module_loader.js',
'web/static/src/session.js',
'web/static/src/core/browser/cookie.js',
@@ -0,0 +1,3 @@
if (!Object.hasOwn) {
Object.hasOwn = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key);
}