UVE: Firefox shows "about:srcdoc" error in the canvas when a traditional page assigns window.location

Abierto
#38,605 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
65/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
java, javascript
Área
frontend, web-dev

Línea de trabajo

Start in dot-uve-iframe.component.ts and trace insertPageContent, where traditional page HTML is written to the canvas iframe's srcdoc. Reproduce the Firefox failure using the steps in the issue, then inspect how the editor handles iframe navigation and hash-only navigation. Done means assigned window.location no longer leaves the Firefox canvas on an error page, while reload, hash handling, and Chromium behavior still meet the acceptance criteria.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

dotCMS : UVE OKR : Customer Support Team : Maintenance Type : Defect
Problem Statement

In Firefox, when a traditional (VTL) page is open in the Universal Visual Editor and a script on the page navigates by assigning window.location / window.location.href (for example to the current URL with added query-string parameters), the editor canvas is replaced by Firefox's own "Hmm. That address doesn't look right." error page ("Firefox can't connect to the server at about:srcdoc"). Editors have to refresh the browser tab to get the page back.

UVE renders traditional pages by writing the server-rendered HTML into the canvas iframe's srcdoc (dot-uve-iframe.component.ts, insertPageContent, introduced by #36583). Inside that iframe the document's location is about:srcdoc, so a page script that builds a navigation from window.location targets about:srcdoc, which Firefox treats as an invalid address.

A common real-world trigger is a cookie/privacy consent banner that, after the visitor clicks "Accept", writes the consent cookie and then navigates to the current URL (often with extra query parameters) so consent-dependent scripts are rendered. The same applies to any page script that navigates itself (language/region switchers, JS redirects). Sites migrating from the 5.x Edit Mode, which loaded the page by its real URL, did not hit this.

Impact: editors only (live site visitors are unaffected), on first access before the consent cookie exists, every time. It reads to editors as a backend malfunction.

Browsers: Firefox only. Chrome and Chromium-based browsers handle the same navigation without the error. Per the reporter, location.reload() works in Firefox too; the failure is on assignment to window.location / window.location.href.

Steps to Reproduce
  1. Open the dotCMS demo site (demo.dotcms.com) in Firefox and log in to the backend.
  2. Open any traditional page (e.g. /index) in the Page Editor (UVE).
  3. Open the browser developer tools (F12) → Console, and switch the JavaScript context selector to the canvas iframe (about:srcdoc).
  4. Run: window.location.href = window.location
  5. Observe: the canvas shows Firefox's "Hmm. That address doesn't look right." / "can't connect to the server at about:srcdoc" page instead of the page content. Only a full browser-tab refresh restores the editor.
  6. Repeat steps 1–4 in Chrome: the canvas does not break.

Real-world variant: add a script to a page template that, on a button click, sets a cookie and then sets window.location.href to the current URL plus a query parameter; clear cookies; open the page in UVE in Firefox and click the button.

Acceptance Criteria
  • In Firefox, a traditional page in UVE that assigns window.location / window.location.href (to its own URL, with or without added query parameters) does not leave the canvas on a browser error page; the editor keeps or reloads the page in the current editor mode.
  • Behavior in Chrome/Chromium-based browsers is unchanged.
  • location.reload() from page scripts continues to work in all supported browsers.
  • Hash-only navigation (#section) keeps its current in-canvas scroll handling.
dotCMS Version

dotEvergreen, current release (reproduced on demo.dotcms.com). Traditional pages have rendered through srcdoc since #36583.

Severity

Medium - Some functionality impacted

Links
Lenguaje dominante
Java
Estrellas
972
Forks
493
Merge medio
2 d 12 h
PR fusionados (30 d)
228

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de dotCMS/core

Todos los issues de dotCMS/core

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.