[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#126447 X-original-commit: b22c1d942374014e0d50e5429c3f89cc1ca18173 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com> Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
This commit is contained in:
@@ -81,7 +81,15 @@ var ColorpickerWidget = Widget.extend({
|
||||
// Need to be bound on all documents to work in all possible cases (we
|
||||
// have to be able to start dragging/moving from the colorpicker to
|
||||
// anywhere on the screen, crossing iframes).
|
||||
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 {
|
||||
// We cannot access the document (cross origin).
|
||||
return false;
|
||||
}
|
||||
})].map(w => w.document));
|
||||
this.throttleOnMouseMove = throttleForAnimation((ev) => {
|
||||
this._onMouseMovePicker(ev);
|
||||
this._onMouseMoveSlider(ev);
|
||||
|
||||
Reference in New Issue
Block a user