blob: 82433317e223da8ec5e2c10e5fd90dd799b94159 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="/resources/js-test-pre.js"></script>
<script>
description('This tests calling setData with a HTML which looks like one generated by Microsoft Word. The HTML should be sanitized in another document');
jsTestIsAsync = true;
if (window.internals)
internals.settings.setCustomPasteboardDataEnabled(true);
onmessage = (event) => {
originalHTML = event.data.originalHTML;
htmlReadInSameDocument = event.data.html;
shouldBeEqualToString('htmlReadInSameDocument', originalHTML);
typesInSameDocument = event.data.types;
shouldBeEqualToString('JSON.stringify(typesInSameDocument)', '["text/html"]');
itemsInSameDocument = event.data.items;
shouldBeEqualToString('JSON.stringify(itemsInSameDocument)', '[{"kind":"string","type":"text/html"}]');
document.getElementById('destination').focus();
if (window.testRunner)
document.execCommand('paste');
}
function doPaste(event) {
shouldBeFalse('html = event.clipboardData.getData("text/html"); html.includes("/* List Definitions */")');
shouldBeFalse('html.includes("[if !supportLists]")');
shouldBeFalse('html.includes("[endif]")');
shouldBeFalse('html.includes("mso-list:")');
document.getElementById('destination').remove();
finishJSTest();
}
</script>
<iframe src="http://localhost:8000/security/clipboard/resources/copy-mso-list.html"></iframe>
<div id="destination" onpaste="doPaste(event)" contenteditable>3. Paste here</div>
<script src="/resources/js-test-post.js"></script>
</body>
</html>