blob: 1e8454242b42cfd5f630acfcd08f3a04ab61b9b2 [file] [log] [blame]
This tests calling setData with a HTML in a null origin document. The HTML should be sanitized in another document
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS htmlReadInSameDocument is "\n <meta content=\"secret\"><b onmouseover=\"dangerousCode()\">hello</b><!-- secret-->, world\n <script>function dangerousCode() { }</script>\n"
PASS JSON.stringify(typesInSameDocument) is "[\"text/html\"]"
PASS JSON.stringify(itemsInSameDocument) is "[{\"kind\":\"string\",\"type\":\"text/html\"}]"
PASS html = event.clipboardData.getData("text/html"); html.includes("hello") is true
PASS html.includes(", world") is true
PASS html.includes("secret") is false
PASS html.includes("dangerousCode") is false
PASS JSON.stringify(event.clipboardData.types) is "[\"text/html\"]"
PASS JSON.stringify(Array.from(event.clipboardData.items).map((item) => ({kind: item.kind, type: item.type}))) is "[{\"kind\":\"string\",\"type\":\"text/html\"}]"
PASS successfullyParsed is true
TEST COMPLETE