mirror of
https://github.com/servo/servo.git
synced 2025-08-17 03:15:34 +01:00
support structured cloning for Blob
This commit is contained in:
parent
ec84560e7f
commit
5c4f0be048
4 changed files with 163 additions and 24 deletions
|
@ -90879,6 +90879,12 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"html/infrastructure/safe-passing-of-structured-data/structured_clone_blob.html": [
|
||||
[
|
||||
"/html/infrastructure/safe-passing-of-structured-data/structured_clone_blob.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"html/infrastructure/terminology/plugins/text-plain.html": [
|
||||
[
|
||||
"/html/infrastructure/terminology/plugins/text-plain.html",
|
||||
|
@ -173218,6 +173224,10 @@
|
|||
"da39a3ee5e6b4b0d3255bfef95601890afd80709",
|
||||
"support"
|
||||
],
|
||||
"html/infrastructure/safe-passing-of-structured-data/structured_clone_blob.html": [
|
||||
"2a3deba2534cad6f5e0aa85cfc3c90debcead20a",
|
||||
"testharness"
|
||||
],
|
||||
"html/infrastructure/terminology/.gitkeep": [
|
||||
"da39a3ee5e6b4b0d3255bfef95601890afd80709",
|
||||
"support"
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Safe passing of structured data - Blob</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
async_test(function(t) {
|
||||
var blob = new Blob(['<a id="a"><b id="b">hey!</b></a>'], {type:"text/plain"});
|
||||
window.addEventListener("message", this.step_func(function(msg) {
|
||||
assert_true(msg.data instanceof Blob);
|
||||
assert_equals(msg.data.size, blob.size);
|
||||
assert_equals(msg.data.type, blob.type);
|
||||
var cloned_content, original_content;
|
||||
var reader = new FileReader();
|
||||
reader.addEventListener("loadend", this.step_func(function() {
|
||||
original_content = reader.result;
|
||||
var reader2 = new FileReader();
|
||||
reader2.addEventListener("loadend", this.step_func_done(function() {
|
||||
cloned_content = reader2.result;
|
||||
assert_equals(typeof cloned_content, typeof original_content);
|
||||
assert_equals(cloned_content, original_content);
|
||||
}));
|
||||
reader2.readAsText(msg.data);
|
||||
}));
|
||||
reader.readAsText(blob);
|
||||
}), false);
|
||||
window.postMessage(blob, '*');
|
||||
}, "Cloning a Blob into the same realm");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue