Skip to content
Snippets Groups Projects
Commit 8ff33c75 authored by Guillaume (gdi)'s avatar Guillaume (gdi)
Browse files

[FIX] web: prevent traceback in edit mode with embedded video

Since [this other commit], initializing the color picker could trigger a
traceback. The traceback was due to the fact that for users to be able
to drag/move the color picker as they wished across different frames, we
needed access to the document of all the frames on the page.
Unfortunately, if one of these frames was not of the same origin, a
traceback was displayed. This commit corrects how we collect documents
from frames on the page, by only taking those whose document we have the
right to see (which do not raise a cross origin error). I didn't succeed
to reproduce the bug locally, but I got it on the runbot with theme
Nursery / Kiddo by dropping the block banner on the page, the error
appears because the block contains a vimeo video. In fact, you just need
to have embedded content (youtube / vimeo / ... video for example) start
edit mode, click on the block containing the video and the error is
displayed.

[this other commit]: https://github.com/odoo/odoo/commit/63bf363d302fe9f93a824fa6f1ff3bbe21f98088



runbot-22573

closes odoo/odoo#126240

Signed-off-by: default avatarQuentin Smetz (qsm) <qsm@odoo.com>
parent 6c5b702f
No related branches found
No related tags found
No related merge requests found
......@@ -44,7 +44,15 @@ var ColorpickerWidget = Widget.extend({
// anywhere on the screen, crossing iframes).
// TODO adapt in master: these events should probably be bound in
// `start` instead of `init` (at least to be more conventional).
this.$documents = $([window.top, ...Array.from(window.top.frames)].map(w => w.document));
this.$documents = $([window.top, ...Array.from(window.top.frames).filter(frame => {
try {
const document = frame.document;
return !!document;
} catch (error) {
// We cannot access the document (cross origin).
return false;
}
})].map(w => w.document));
this.$documents.on(`mousemove.${this.uniqueId}`, _.throttle((ev) => {
this._onMouseMovePicker(ev);
this._onMouseMoveSlider(ev);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment