XML document in iframe viewer sampler

#40867444 Filed 2022-09-23 Status: New CL 6669633 abandoned

What this checks

Goal

Chromium issue 40867444 asks for XML documents inside iframes to use the XML tree viewer instead of rendering as plain text without tags.

The compatibility-sensitive part is the same-origin DOM API below. Even if the iframe gets a tree viewer, iframe.contentDocument.documentElement must remain the original XML root element, not an inserted HTML wrapper.

Live same-origin XML iframe

Expected with the fix enabled: tags are visible in the iframe and the tree can be expanded/collapsed. Expected DOM in all modes: the document element is <catalog>.

Open XML

DOM compatibility results

These checks cover the concern from comment #14: pages may depend on the iframe document element being the XML document element.

  • wait Loading iframe.

Pass criteria

Visual behavior

A browser with the iframe XML viewer path enabled should show angle-bracket XML tags inside the iframe, similar to top-level XML view-source mode.

DOM behavior

The page should report all green checks. In particular, this JavaScript expression must stay true:

iframe.contentDocument.documentElement.nodeName === 'catalog'

Sample XML

<?xml version="1.0" encoding="UTF-8"?>
<catalog>
  <book id="bk101">
    <title>XML iframe viewer sample</title>
    <author>Chromium repro</author>
    <summary>Tags should be visible in the iframe viewer.</summary>
  </book>
  <book id="bk102">
    <title>DOM compatibility check</title>
    <summary>iframe.contentDocument.documentElement must remain the catalog element.</summary>
  </book>
</catalog>

XSLT table control

Separate XSLT behavior

This iframe loads XML with an xml-stylesheet processing instruction. With native XSLT enabled, it should transform into a styled HTML table. Without XSLT, Chromium may show its XSLT-not-supported message.

XML transformed into a table

Open table XML Open table XSLT

Table transform results

These checks report whether native XSLT transformed the XML into a styled HTML table.

  • wait Loading iframe.

Links

Download XML Download table XML Download table XSLT Chromium issue Abandoned CL 6669633