From ea7764d0a772bca59ad78f1e3bbc9a7e2734f456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Tue, 24 Oct 2023 18:15:40 +0200 Subject: [PATCH] fix: Allow parseXmlString when createNodeIterator is not available (#5805) Related to https://github.com/shaka-project/shaka-player/issues/5804 --- lib/util/xml_utils.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/util/xml_utils.js b/lib/util/xml_utils.js index 543e986eb3..abe74880d6 100644 --- a/lib/util/xml_utils.js +++ b/lib/util/xml_utils.js @@ -397,6 +397,11 @@ shaka.util.XmlUtils = class { return null; } + // Cobalt browser doesn't support document.createNodeIterator. + if (!('createNodeIterator' in document)) { + return rootElem; + } + // SECURITY: Verify that the document does not contain elements from the // HTML or SVG namespaces, which could trigger script execution and XSS. const iterator = document.createNodeIterator(