-
Notifications
You must be signed in to change notification settings - Fork 30.2k
[FIX] web: add fallback to Object.hasOwn in patch function #160758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correctly fixing the reported issue.
But it seems like after that, there is still a blocking error about OwlError: Cannot make the given value reactive.. which when you close you get another error stack.at is not a function which you can't close ever (don't know if it keeps crashing or the close not closing, it's a bit laggy on browserstack).
I've tested on iphone 12/14.7 and some macOs
Did you face an OS/browser where fixing this was enough to then have a smooth (without error) navigation afterward?
Could you please add Fixes https://github.com/odoo/odoo/issues/142022 in your commit message after the opw tag please?
Sadly, the community already noticed and reported this issue half a year ago 🤦 Sad we don't have a real Github team.
a6449ba to
0cf8664
Compare
|
@rdeodoo I checked from 15.0 onward because that's the last version of iOS that seems to still be supported by Apple's security patches and the oldest I had available to try on my own computer. I checked the error you reported and found at least another one. I don't think they're related but I keep getting kicked out of Browser stack when I try to investigate. I'll look more into it tomorrow. However, it might be good to already go ahead with this one as I can confirm it makes Odoo on iOS versions between 15.0 and 15.3 usable. |
|
Indeed, seems like livechat in the frontend introduces the issue because mail has a few calls to .at which are not supported by Safari <15.4 I added a second commit. It should fix that error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, all errors are correctly fixed, tried on iPhone 13 Mini v15.3
Very low effort to support old (but still widely used) iOs devices on the frontend.
Arguably the polyfill could be omitted in the backend assets since for the backend, we ask clients to have an kind of updated browser, which is not the case for frontend visitors. But it can't harm to add it in the backend now that it's there.
@odoo/rd-framework-js Any opinion on this diff? Maybe the hasOwn could also be a global polyfill?
|
@rdeodoo The margin is very tight between telling the customer that those versions aren't supported or introducing those polyfills. 1% of ios safari users are using a version <= 15.3, and 0.54% <= 13.3. This means that this PR will only help 0.46% of ios safari users, as for the 0.54% remaining, it won't work either because of the optional chaining syntax, which their browser doesn't support, and for which we cannot write a polyfill anyway. Moreover, those in [15.0, 15.3] could simply be asked to update, and those below 15.0 are on a version that is no longer supported by apple (according to Arthur). That being said, those polyfills are harmless, so we agree to introduce them. We would indeed add a global polyfill for hasOwn. That way, polyfills are gathered at a unique place and can be easily clean up when necessary, without polluting the rest of the codebase. They should be added to the frontend assets only. |
|
I globally agree, but we are speaking about website visitors, we can't ask them to upgrade, as opposed to Odoo customers. |
6c1716f to
6e646cf
Compare
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]: odoo@04fddc1 Fixes odoo#142022 opw-3824593
Commit [1] refactored the mail code and introduced a few .at called on Array typed objects. This is not supported in lower versions of iOS which some of our users and visitors still use as shown by [2]. This commit introduces a polyfill to support the feature on Safari <=15.3. [1]: odoo@631ae1c [2]: odoo#142022 opw-3824593
6e646cf to
d8ea0ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robodoo r+
God bless those old iPhone users
|
@detrouxdev @rdeodoo because this PR has multiple commits, I need to know how to merge it:
|
|
@robodoo rebase-ff |
|
Merge method set to rebase and fast-forward. |
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]: 04fddc1 Fixes #142022 opw-3824593 Part-of: #160758
|
@detrouxdev @rdeodoo this pull request has forward-port PRs awaiting action (not merged or closed): |
3 similar comments
|
@detrouxdev @rdeodoo this pull request has forward-port PRs awaiting action (not merged or closed): |
|
@detrouxdev @rdeodoo this pull request has forward-port PRs awaiting action (not merged or closed): |
|
@detrouxdev @rdeodoo this pull request has forward-port PRs awaiting action (not merged or closed): |
|
@detrouxdev @rdeodoo this pull request has forward-port PRs awaiting action (not merged or closed): |
2 similar comments
|
@detrouxdev @rdeodoo this pull request has forward-port PRs awaiting action (not merged or closed): |
|
@detrouxdev @rdeodoo this pull request has forward-port PRs awaiting action (not merged or closed): |
|
this two polyfills should apply to backend as well as frontend |
|
It's not something we want in the backend, as Odoo users are supposed to run it on up to date (or fairly up to date) browser. It's however completely different for the frontend, as you can't control who will visit your company website. It could be anyone from anywhere with any device. It would be unacceptable if your website was to crash for those visitors. |
should add fallback for backend as well as frontend, otherwise error will occurred on some old android devices. ref: odoo#160758
The patch function was changed at commit 1. This introduced a call to
Object.hasOwnwhich 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 introduces a fallback to Object.prototype.hasOwnProperty for browsers that do not have Object.hasOwn implemented.
opw-3824593