[FW][FIX] web: fix colorpicker "unknown CORS error" on safari#64389
Closed
fw-bot wants to merge 1 commit intoodoo:masterfrom
Closed
[FW][FIX] web: fix colorpicker "unknown CORS error" on safari#64389fw-bot wants to merge 1 commit intoodoo:masterfrom
fw-bot wants to merge 1 commit intoodoo:masterfrom
Conversation
Previously, when opening a colorpicker in safari, the crash manager would open with the message "An unknown CORS error occured [...]". This is actually odoo's default message when an error has no file, line or column, which is usually the case for security reasons on CORS error. This is however not a true CORS error, but a "ResizeObserver loop completed with undelivered notifications" error, which also does not report file, line and col for the error. This error is caused by the fact that in webkit, the baseline of an empty input is considered to be at the bottom of the input element, rather than at the baseline of the text of the input once it has some content. (see https://bugs.webkit.org/show_bug.cgi?id=142968 ) In the case of the colorpicker, it uses a ResizeObserver to update its UI, including updating the content of its inputs. This will cause the first _updateUI to fill the empty inputs, which changes the layout of the widget content and changes its size. Changing the size of an element inside of a handler of a ResizeObserver on that same element will cause an error and not call the callback again, so as to prevent infinite loop. This commit fixes that by filling the inputs before attaching the ResizeObserver, so that it has its final size from the get-go, and _updateUI will no longer change the layout/size, causing this error. opw-2419296 X-original-commit: 5e9e35e
Contributor
Contributor
Author
|
Ping @sdegueldre, @qsm-odoo To merge the full chain, say
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
Contributor
|
@fw-bot r+ |
robodoo
pushed a commit
that referenced
this pull request
Jan 12, 2021
Previously, when opening a colorpicker in safari, the crash manager would open with the message "An unknown CORS error occured [...]". This is actually odoo's default message when an error has no file, line or column, which is usually the case for security reasons on CORS error. This is however not a true CORS error, but a "ResizeObserver loop completed with undelivered notifications" error, which also does not report file, line and col for the error. This error is caused by the fact that in webkit, the baseline of an empty input is considered to be at the bottom of the input element, rather than at the baseline of the text of the input once it has some content. (see https://bugs.webkit.org/show_bug.cgi?id=142968 ) In the case of the colorpicker, it uses a ResizeObserver to update its UI, including updating the content of its inputs. This will cause the first _updateUI to fill the empty inputs, which changes the layout of the widget content and changes its size. Changing the size of an element inside of a handler of a ResizeObserver on that same element will cause an error and not call the callback again, so as to prevent infinite loop. This commit fixes that by filling the inputs before attaching the ResizeObserver, so that it has its final size from the get-go, and _updateUI will no longer change the layout/size, causing this error. opw-2419296 closes #64389 X-original-commit: 5e9e35e Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Previously, when opening a colorpicker in safari, the crash manager
would open with the message "An unknown CORS error occured [...]". This
is actually odoo's default message when an error has no file, line or
column, which is usually the case for security reasons on CORS error.
This is however not a true CORS error, but a "ResizeObserver loop
completed with undelivered notifications" error, which also does not
report file, line and col for the error.
This error is caused by the fact that in webkit, the baseline of an
empty input is considered to be at the bottom of the input element,
rather than at the baseline of the text of the input once it has some
content. (see https://bugs.webkit.org/show_bug.cgi?id=142968 )
In the case of the colorpicker, it uses a ResizeObserver to update its
UI, including updating the content of its inputs. This will cause the
first _updateUI to fill the empty inputs, which changes the layout of
the widget content and changes its size. Changing the size of an element
inside of a handler of a ResizeObserver on that same element will cause
an error and not call the callback again, so as to prevent infinite
loop.
This commit fixes that by filling the inputs before attaching the
ResizeObserver, so that it has its final size from the get-go, and
_updateUI will no longer change the layout/size, causing this error.
opw-2419296
Forward-Port-Of: #64244