From e6dd94aa21e230b79986e3b58079df4bc80ba3d8 Mon Sep 17 00:00:00 2001 From: Benoit Socias Date: Thu, 8 Jun 2023 13:35:16 +0000 Subject: [PATCH] [FIX] website: not fail in Firefox when leaving/entering website app Since [1], navigating from the website application to another one raises an error when using Firefox. This commit avoids looking at the URL if the iframe is not available. It seems that in Firefox the `pagehide` event is triggered after the iframe is released. Steps to reproduce: - Use Firefox. - Go to the Website app. - Go to Discuss. => An error popup was displayed. [1]: https://github.com/odoo/odoo/commit/eacfab230b8b6d676f378ad74a402849af83dcbb task-3302981 opw-3349388 opw-3357461 opw-3357511 closes odoo/odoo#124940 X-original-commit: 57c3ab3058d4e2eee581f5c35a7a9e1b9ac83593 Signed-off-by: Romain Derie (rde) Signed-off-by: Benoit Socias (bso) --- .../src/client_actions/website_preview/website_preview.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/static/src/client_actions/website_preview/website_preview.js b/addons/website/static/src/client_actions/website_preview/website_preview.js index 851936b6775..f8e1f8aa16b 100644 --- a/addons/website/static/src/client_actions/website_preview/website_preview.js +++ b/addons/website/static/src/client_actions/website_preview/website_preview.js @@ -475,7 +475,7 @@ export class WebsitePreview extends Component { } } _onPageHide() { - this.lastHiddenPageURL = this.iframe.el.contentWindow.location.href; + this.lastHiddenPageURL = this.iframe.el && this.iframe.el.contentWindow.location.href; // Normally, at this point, the websiteRootInstance is already set to // `undefined`, as we want to do that as early as possible to prevent // the editor to be in an unstable state. But some events not managed