blob: 3a6458537e5bcd6135a5fc15428708af4090b120 [file] [log] [blame]
This tests getData strips away secrets and dangerous code when copying inside a null origin document.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS typesInNullOrigin.includes("text/html") is true
PASS htmlInNullOrigin.includes("secret") is false
PASS htmlInNullOrigin.includes("dangerousCode") is false
PASS parsedTree = (new DOMParser).parseFromString(htmlInNullOrigin, "text/html"); !!parsedTree.querySelector("b"); is true
PASS parsedTree.querySelector("b").textContent is "16th President of the United States:"
PASS (new URL(parsedTree.querySelector("img").src)).protocol is "blob:"
PASS parsedTree.querySelector("img").src.includes("resources/abe.png") is false
PASS itemsInNullOrigin.some((item) => item.kind == "string" && item.type == "text/html") is true
PASS typesInNullOrigin.includes("text/html") is true
PASS htmlInSameDocument.includes("secret") is false
PASS htmlInSameDocument.includes("dangerousCode") is false
PASS parsedTree = (new DOMParser).parseFromString(htmlInNullOrigin, "text/html"); !!parsedTree.querySelector("b"); is true
PASS parsedTree.querySelector("b").textContent is "16th President of the United States:"
FAIL (new URL(parsedTree.querySelector("img").src)).protocol should be file:. Was blob:.
FAIL parsedTree.querySelector("img").src.includes("resources/abe.png") should be true. Was false.
PASS itemsInSameDocument.some((item) => item.kind == "string" && item.type == "text/html") is true
PASS successfullyParsed is true
TEST COMPLETE