diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/dom/nodes/Document-createElement-namespace-tests/generate.py | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/dom/nodes/Document-createElement-namespace-tests/generate.py')
-rwxr-xr-x | testing/web-platform/tests/dom/nodes/Document-createElement-namespace-tests/generate.py | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/testing/web-platform/tests/dom/nodes/Document-createElement-namespace-tests/generate.py b/testing/web-platform/tests/dom/nodes/Document-createElement-namespace-tests/generate.py new file mode 100755 index 0000000000..a0bca546c7 --- /dev/null +++ b/testing/web-platform/tests/dom/nodes/Document-createElement-namespace-tests/generate.py @@ -0,0 +1,80 @@ +#!/usr/bin/python + +from __future__ import print_function + +import os +import sys + +THIS_NAME = u"generate.py" + +# Note: these lists must be kept in sync with the lists in +# Document-createElement-namespace.html, and this script must be run whenever +# the lists are updated. (We could keep the lists in a shared JSON file, but +# seems like too much effort.) +FILES = ( + (u"empty", u""), + (u"minimal_html", u"<!doctype html><title></title>"), + + (u"xhtml", u'<html xmlns="http://www.w3.org/1999/xhtml"></html>'), + (u"svg", u'<svg xmlns="http://www.w3.org/2000/svg"></svg>'), + (u"mathml", u'<mathml xmlns="http://www.w3.org/1998/Math/MathML"></mathml>'), + + (u"bare_xhtml", u"<html></html>"), + (u"bare_svg", u"<svg></svg>"), + (u"bare_mathml", u"<math></math>"), + + (u"xhtml_ns_removed", u"""\ +<html xmlns="http://www.w3.org/1999/xhtml"> + <head><script> + var newRoot = document.createElementNS(null, "html"); + document.removeChild(document.documentElement); + document.appendChild(newRoot); + </script></head> +</html> +"""), + (u"xhtml_ns_changed", u"""\ +<html xmlns="http://www.w3.org/1999/xhtml"> + <head><script> + var newRoot = document.createElementNS("http://www.w3.org/2000/svg", "abc"); + document.removeChild(document.documentElement); + document.appendChild(newRoot); + </script></head> +</html> +"""), +) + +EXTENSIONS = ( + u"html", + u"xhtml", + u"xml", + u"svg", + # Was not able to get server MIME type working properly :( + #"mml", +) + +def __main__(): + if len(sys.argv) > 1: + print(u"No arguments expected, aborting") + return + + if not os.access(THIS_NAME, os.F_OK): + print(u"Must be run from the directory of " + THIS_NAME + u", aborting") + return + + for name in os.listdir(u"."): + if name == THIS_NAME: + continue + os.remove(name) + + manifest = open(u"MANIFEST", u"w") + + for name, contents in FILES: + for extension in EXTENSIONS: + f = open(name + u"." + extension, u"w") + f.write(contents) + f.close() + manifest.write(u"support " + name + u"." + extension + u"\n") + + manifest.close() + +__main__() |