diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /editor/libeditor/tests/test_sanitizer_on_paste.html | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | editor/libeditor/tests/test_sanitizer_on_paste.html | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/editor/libeditor/tests/test_sanitizer_on_paste.html b/editor/libeditor/tests/test_sanitizer_on_paste.html new file mode 100644 index 0000000000..09c6ff4fb2 --- /dev/null +++ b/editor/libeditor/tests/test_sanitizer_on_paste.html @@ -0,0 +1,48 @@ +<!DOCTYPE HTML> +<html> +<head> + <meta charset="utf-8"> + <title>Test pasting table rows</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <script src="/tests/SimpleTest/EventUtils.js"></script> + <link rel="stylesheet" href="/tests/SimpleTest/test.css"/> +</head> +<body> +<textarea></textarea> +<div contenteditable="true">Paste target</div> +<script> + SimpleTest.waitForExplicitFinish(); + function fail() { + ok(false, "Should not run event handlers."); + } + document.addEventListener('copy', ev => { + dump("IN LISTENER\n"); + const payload = `<svg><style><image href=file_sanitizer_on_paste.sjs onerror=fail() onload=fail()>` + + ev.preventDefault(); + ev.clipboardData.setData('text/html', payload); + ev.clipboardData.setData('text/plain', payload); + }); + + document.getElementsByTagName("textarea")[0].focus(); + synthesizeKey("c", { accelKey: true } /* aEvent*/); + + let div = document.getElementsByTagName("div")[0]; + div.focus(); + synthesizeKey("v", { accelKey: true } /* aEvent*/); + + let svg = div.firstChild; + is(svg.nodeName, "svg", "Node name should be svg"); + + let style = svg.firstChild; + if (style) { + is(style.firstChild, null, "Style should not have child nodes."); + } else { + ok(false, "Should have gotten a node."); + } + + var s = document.createElement("script"); + s.src = "file_sanitizer_on_paste.sjs?report=1"; + document.body.appendChild(s); +</script> +</body>
\ No newline at end of file |