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

Aperta
#38,605 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java, javascript
Ambito
frontend, web-dev

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Java
Stelle
972
Fork
493
Merge medio
2g 12h
PR unite (30g)
228

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di dotCMS/core

Tutte le issue di dotCMS/core

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.