re-structure blob, structured serialization

This commit is contained in:
Gregory Terzian 2019-09-01 03:18:42 +08:00
parent 7aa68c8fe7
commit 6e8a85482c
31 changed files with 997 additions and 489 deletions

View file

@ -15,3 +15,6 @@
[Opening a blob URL in a new window by clicking an <a> tag works immediately before revoking the URL.]
expected: FAIL
[Fetching a blob URL immediately before revoking it works in <script> tags.]
expected: TIMEOUT

View file

@ -2,6 +2,9 @@
[Revoke blob URL after creating Request, will fetch]
expected: FAIL
[Revoke blob URL after calling fetch, fetch should succeed]
expected: FAIL
[url-with-fetch.any.html]
[Revoke blob URL after creating Request, will fetch]

View file

@ -358970,9 +358970,15 @@
{}
]
],
"html/infrastructure/safe-passing-of-structured-data/structured_clone_blob.html": [
"html/infrastructure/safe-passing-of-structured-data/structured_clone_blob.window.js": [
[
"html/infrastructure/safe-passing-of-structured-data/structured_clone_blob.html",
"html/infrastructure/safe-passing-of-structured-data/structured_clone_blob.window.html",
{}
]
],
"html/infrastructure/safe-passing-of-structured-data/structured_clone_blob_array.window.js": [
[
"html/infrastructure/safe-passing-of-structured-data/structured_clone_blob_array.window.html",
{}
]
],
@ -653472,8 +653478,12 @@
"995edac8da9d95ac6f151863b5cd48994941a347",
"testharness"
],
"html/infrastructure/safe-passing-of-structured-data/structured_clone_blob.html": [
"6b1abf5ef8d30c2494effac489db79732d0c12d4",
"html/infrastructure/safe-passing-of-structured-data/structured_clone_blob.window.js": [
"490e78165de820d31f25cd3f09416a8cbf1b1c66",
"testharness"
],
"html/infrastructure/safe-passing-of-structured-data/structured_clone_blob_array.window.js": [
"b976d5b212652bf763b4a6039a70c26758c84ccf",
"testharness"
],
"html/infrastructure/safe-passing-of-structured-data/structuredclone_0.html": [

View file

@ -1,35 +0,0 @@
<!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>

View file

@ -0,0 +1,22 @@
async_test(function(t) {
var blob = new Blob(['<a id="a"><b id="b">hey!</b></a>'], {type:"text/plain"});
onmessage = t.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", t.step_func(function() {
original_content = reader.result;
var reader2 = new FileReader();
reader2.addEventListener("loadend", t.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);
});
postMessage(blob, '*');
}, "Cloning a blob into the same realm");

View file

@ -0,0 +1,25 @@
async_test(function(t) {
var blob = new Blob(['<a id="a"><b id="b">hey!</b></a>'], {type:"text/plain"});
var another_blob = new Blob(['<a id="a"><b id="b">hey!</b></a>'], {type:"text/plain"});
onmessage = t.step_func(function(msg) {
assert_true(msg.data instanceof Array);
assert_equals(msg.data.length, 2);
msg.data.forEach((function(blob, index) {
assert_true(blob instanceof Blob);
var cloned_content, original_content;
var reader = new FileReader();
reader.addEventListener("loadend", t.step_func(function() {
original_content = reader.result;
var reader2 = new FileReader();
reader2.addEventListener("loadend", t.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[index]);
}));
reader.readAsText(blob);
}));
});
postMessage([blob, another_blob], '*');
}, "Cloning an array of blobs into the same realm");