v147 · Security · Memory Safety

Compatibility Lab

Probes DOMParser with all four XML MIME types, XMLSerializer, and XMLHttpRequest document mode. Runs a live XML parse round-trip via DOMParser → XMLSerializer across well-formed, namespace-heavy, and intentionally malformed inputs to confirm the Rust-backed parser handles edge cases correctly.

API probes

XML parser backend matrix

API / scenarioChrome ≤146Chrome 147+Parser backend
DOMParser — application/xmlC++ (libxml2)✓ RustNon-XSLT XML parse
DOMParser — text/xmlC++ (libxml2)✓ RustNon-XSLT XML parse
DOMParser — image/svg+xmlC++ (libxml2)✓ RustSVG XML parse
DOMParser — text/htmlC++ HTML parserC++ HTML parserHTML (unchanged)
XSLTProcessorC++ (libxml2)C++ (libxml2)XSLT path unchanged
XMLHttpRequest responseXMLC++ (libxml2)✓ RustResponse XML parse

Non-XSLT parser surface

Live XML round-trip test

DOMParser → XMLSerializer round-trip
Click "Run XML parse tests" to exercise DOMParser with various XML inputs…

Safe XML parsing pattern

/* XML parsing in Chrome 147 — same API, Rust backend */ /* The web API is unchanged — your existing code continues to work. Chrome 147 only changes the parser implementation (C++ → Rust). */ const parser = new DOMParser(); const serializer = new XMLSerializer(); /* Parse XML — Rust-backed in Chrome 147+ */ function parseXML(xmlString, mimeType = 'application/xml') { const doc = parser.parseFromString(xmlString, mimeType); /* Check for parse errors */ const errNode = doc.querySelector('parsererror'); if (errNode) { throw new Error('XML parse error: ' + errNode.textContent.trim()); } return doc; } /* Roundtrip: parse then serialise */ function xmlRoundtrip(xmlString) { const doc = parseXML(xmlString); return serializer.serializeToString(doc); } /* Fetch XML — Rust parser handles response body in Chrome 147+ */ async function fetchXML(url) { const response = await fetch(url); const text = await response.text(); return parseXML(text); } /* XMLHttpRequest response document — also Rust-backed in Chrome 147+ */ function xhrXML(url, callback) { const xhr = new XMLHttpRequest(); xhr.responseType = 'document'; xhr.open('GET', url); xhr.onload = () => callback(xhr.responseXML); xhr.send(); } /* No API changes needed — memory safety improvement is transparent. */

references

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗