v147 · Security · Memory Safety
XML parsing in Rust for non-XSLT scenarios
Chrome 147 replaces the C++ XML parser used in non-XSLT contexts, including DOMParser, XMLHttpRequest.responseXML, and SVG XML document/image parsing paths, with a new Rust-based parser. Rust's memory safety guarantees eliminate an entire class of memory corruption bugs that previously required patching in C++.
concepts
-
Rust Parser Demo
Parses XML using the browser's native parser via
DOMParserandXMLSerializer— showing the same API surface now backed by Rust in Chrome 147. Edge cases, malformed input, and large documents are parsed identically. -
Safety Comparison
Explains the memory safety properties of Rust versus C++, the class of bugs the switch eliminates, and how the Rust parser is integrated without changing the public web API.
-
XML Security Fuzzer
Send common XML security test cases — entity bomb, deep nesting, malformed markup, large attributes — through
DOMParserand inspect parse timing, node count, max depth, and structural analysis. Shows how Chrome 147's Rust parser defends against attack patterns. -
XML Parse Speed Test
Benchmark
DOMParserthroughput (MB/s) across small, medium, and large documents with configurable complexity profiles — simple, deeply nested, many attributes, namespace-heavy, mixed content. A malformed-XML panel lets you test edge case handling with one click. -
Compatibility Lab
Probes
DOMParserwith all four XML MIME types,XMLSerializer, andXMLHttpRequestdocument mode. Runs a live XML parse round-trip across well-formed, namespace-heavy, and intentionally malformed inputs to confirm the Rust-backed parser handles edge cases correctly.
why it shipped
XML parsing in C++ is historically prone to memory safety bugs — use-after-free, heap buffer overflows, and integer overflows in complex parsing state machines. These bugs have been a source of browser security vulnerabilities. Rust's ownership model prevents this class of bug at compile time, with no garbage collector and no runtime performance overhead. Chrome 147 migrates the non-XSLT XML parser to Rust, significantly reducing the attack surface for XML-based exploits.
the change
// The web API is unchanged — same DOMParser, same results
// Chrome 147 now uses Rust under the hood for these operations:
// 1. DOMParser parsing XML/XHTML
const parser = new DOMParser();
const doc = parser.parseFromString(xmlString, 'application/xml');
// 2. XMLHttpRequest with responseType 'document' / responseXML
const xhr = new XMLHttpRequest();
xhr.responseType = 'document';
xhr.open('GET', '/data.xml');
xhr.send();
// 3. fetched XML text explicitly handed to DOMParser
const response = await fetch('/data.xml');
const xmlText = await response.text();
const doc2 = parser.parseFromString(xmlText, 'application/xml');
// XSLT (XSLTProcessor) still uses the C++ parser —
// see v147/remove-inline-xslt-for-production-of-svg for the
// related XSLT change in Chrome 147
references
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗