tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 7af27067438e287edde460a32cc5f234c15b261f
parent 1aadb8502c27eef95c92f3c08ccb1f98544c2090
Author: Tom Schuster <tschuster@mozilla.com>
Date:   Tue, 21 Oct 2025 12:02:59 +0000

Bug 1995299 - Remove bad test for names in the Sanitizer. r=smaug

The Sanitizer API used to disallow certain names, but that isn't the
case anymore.

The only reason why the test is currently still passing is accidental:

  const elems_invalid = [
    "", {name: ""},
  ];

"" and {name: ""} are the same empty name, so the constructor throws
because there is a duplicate.

Differential Revision: https://phabricator.services.mozilla.com/D269224

Diffstat:
Mtesting/web-platform/tests/sanitizer-api/sanitizer-names.tentative.html | 49-------------------------------------------------
1 file changed, 0 insertions(+), 49 deletions(-)

diff --git a/testing/web-platform/tests/sanitizer-api/sanitizer-names.tentative.html b/testing/web-platform/tests/sanitizer-api/sanitizer-names.tentative.html @@ -6,55 +6,6 @@ </head> <body> <script> - // Like assert_array_equals, but disregard element order. - function assert_array_same(actual, expected) { - assert_array_equals(actual.sort(), expected.sort()); - } - - // Element names: - const elems_valid = [ - "p", "template", "span", "custom-elements", "potato", - // Arguments will be stringified, so anything that stringifies to a valid - // name is also valid. - 123 - ]; - const elems_invalid = [ - "", {name: ""}, - ]; - - // Attribute names: - const attrs_valid = [ - "href", "span", - ]; - const attrs_invalid = [ - "", {name: ""}, - ]; - - for (const item of ["elements", "removeElements", "replaceWithChildrenElements"]) { - test(t => { - const sanitizer = new Sanitizer({[item]: elems_valid}); - assert_array_same(sanitizer.get()[item].map(x => x.name), - elems_valid.map(x => "" + x)); - }, `Element names in config item: ${item}`); - test(t => { - assert_throws_js(TypeError, _ => { - new Sanitizer({[item]: elems_valid.concat(elems_invalid)}); - }); - }, `Invalid element names in config item: ${item}`); - } - for (const item of ["attributes", "removeAttributes"]) { - test(t => { - const sanitizer = new Sanitizer({[item]: attrs_valid}); - assert_array_same(sanitizer.get()[item].map(x => x.name), - attrs_valid.map(x => "" + x)); - }, `Attribute names in config item: ${item}`); - test(t => { - assert_throws_js(TypeError, _ => { - new Sanitizer({[item]: attrs_valid.concat(attrs_invalid)}); - }); - }, `Invalid attribute names in config item: ${item}`); - } - // Quick sanity tests for namespaced elements. // Each test case is a duo or triplet: // - a Sanitizer config string for an element.