diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-12-19 16:16:56 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-19 16:16:56 -0500 |
commit | bac9903fbeed0a394a86c0091e727aada665433d (patch) | |
tree | 15f61a4fdcc8bbcc09f10a39e25495fb49cb9a75 /tests | |
parent | aa36d5f657eb32b59d994d08b177a02372b4b01c (diff) | |
parent | 6e8a85482c2068d4dbccb992954271f725570f91 (diff) | |
download | servo-bac9903fbeed0a394a86c0091e727aada665433d.tar.gz servo-bac9903fbeed0a394a86c0091e727aada665433d.zip |
Auto merge of #24123 - gterzian:redo_blob, r=jdm
Restructure Blob, structured serialization
<!-- Please describe your changes on the following line: -->
FIX #24052 and also address the "cloning" half of FIX #23917
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/24123)
<!-- Reviewable:end -->
Diffstat (limited to 'tests')
4 files changed, 61 insertions, 39 deletions
diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 2d83aa9ca40..3729cfe1dc9 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -360210,9 +360210,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", {} ] ], @@ -655445,8 +655451,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": [ diff --git a/tests/wpt/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/structured_clone_blob.html b/tests/wpt/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/structured_clone_blob.html deleted file mode 100644 index 6b1abf5ef8d..00000000000 --- a/tests/wpt/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/structured_clone_blob.html +++ /dev/null @@ -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> diff --git a/tests/wpt/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/structured_clone_blob.window.js b/tests/wpt/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/structured_clone_blob.window.js new file mode 100644 index 00000000000..490e78165de --- /dev/null +++ b/tests/wpt/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/structured_clone_blob.window.js @@ -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"); diff --git a/tests/wpt/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/structured_clone_blob_array.window.js b/tests/wpt/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/structured_clone_blob_array.window.js new file mode 100644 index 00000000000..b976d5b2126 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/structured_clone_blob_array.window.js @@ -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"); |