ladybird/Tests/LibWeb/Text/input/HTML/StructuredClone-serializable-objects.html
2024-03-17 17:16:09 +01:00

32 lines
1.7 KiB
HTML

<script src="../include.js"></script>
<script>
asyncTest(async done => {
let blob = structuredClone(new Blob(["Hello, Blob!"], {type: "text/plain"}));
println(`instanceOf Blob: ${blob instanceof Blob}`);
println(`Blob.type: ${blob.type}`);
let text = await blob.text();
println(`Blob.text(): ${text}`);
let file = structuredClone(new File(["Hello, File!"], "hello.txt", {type: "text/plain"}));
println(`instanceOf File: ${file instanceof File}`);
println(`File.name: ${file.name}`);
println(`File.type: ${file.type}`);
text = await file.text();
println(`File.text(): ${text}`);
println(`File.size: ${file.size}`);
let domMatrixReadOnly = structuredClone(new DOMMatrixReadOnly([1.7976931348623157e+308, 2.2250738585072014e-308, 2.2204460492503131e-016, 40, 50, 60]));
println(`instanceOf DOMMatrixReadOnly: ${domMatrixReadOnly instanceof DOMMatrixReadOnly}`);
println(`DOMMatrixReadOnly: ${JSON.stringify(domMatrixReadOnly)}`);
domMatrixReadOnly = structuredClone(new DOMMatrixReadOnly([10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]));
println(`DOMMatrixReadOnly: ${JSON.stringify(domMatrixReadOnly)}`);
let domMatrix = structuredClone(new DOMMatrix([10, 20, 30, 40, 50, 60]));
println(`instanceOf DOMMatrix: ${domMatrix instanceof DOMMatrix}`);
println(`DOMMatrix: ${JSON.stringify(domMatrix)}`);
domMatrix = structuredClone(new DOMMatrix([10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]));
println(`DOMMatrix: ${JSON.stringify(domMatrix)}`);
done();
});
</script>