mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
Update web-platform-tests to revision 7a767a52741f628430ffbbed46e7f3df68ba3534
Fixes #15648.
This commit is contained in:
parent
a1e4c547f0
commit
4fadf9b0b6
1184 changed files with 22551 additions and 9856 deletions
|
@ -1,39 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Blob.close</title>
|
||||
<link rel=help href="http://dev.w3.org/2006/webapi/FileAPI/#dfn-close">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../support/Blob.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var blob = new Blob(["TEST"]);
|
||||
var sliced = blob.slice();
|
||||
blob.close();
|
||||
|
||||
async_test(function(t) {
|
||||
var reader = new FileReader();
|
||||
|
||||
reader.onload = t.step_func(function(evt) {
|
||||
assert_unreached("Should not dispatch the load event");
|
||||
});
|
||||
|
||||
reader.onerror = t.step_func(function(e) {
|
||||
assert_equals(reader.result, null);
|
||||
assert_equals(reader.error.code, DOMException.INVALID_STATE_ERR);
|
||||
t.done();
|
||||
});
|
||||
|
||||
reader.readAsText(blob, "UTF-8");
|
||||
}, "Closed Blob");
|
||||
|
||||
test_blob(function() {
|
||||
return sliced;
|
||||
}, {
|
||||
expected: "TEST",
|
||||
type: "",
|
||||
desc: "Slice should still have the data."
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -40,6 +40,14 @@
|
|||
test(function() {
|
||||
assert_false('createFor' in URL);
|
||||
}, 'createFor method should not be supported');
|
||||
|
||||
test(function() {
|
||||
var b = new Blob();
|
||||
assert_false('close' in b, 'close in b');
|
||||
assert_false('close' in Blob.prototype, 'close in Blob.prototype');
|
||||
assert_false('isClosed' in b, 'isClosed in b');
|
||||
assert_false('isClosed' in Blob.prototype, 'isClosed in Blob.prototype');
|
||||
}, 'Blob.close() should not be supported');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -55,15 +55,12 @@ interface Blob {
|
|||
|
||||
readonly attribute unsigned long long size;
|
||||
readonly attribute DOMString type;
|
||||
readonly attribute boolean isClosed;
|
||||
|
||||
//slice Blob into byte-ranged chunks
|
||||
|
||||
Blob slice([Clamp] optional long long start,
|
||||
[Clamp] optional long long end,
|
||||
optional DOMString contentType);
|
||||
void close();
|
||||
|
||||
};
|
||||
|
||||
dictionary BlobPropertyBag {
|
||||
|
@ -111,7 +108,7 @@ interface FileReader: EventTarget {
|
|||
// File or Blob data
|
||||
readonly attribute (DOMString or ArrayBuffer)? result;
|
||||
|
||||
readonly attribute DOMError? error;
|
||||
readonly attribute DOMException? error;
|
||||
|
||||
// event handler attributes
|
||||
attribute EventHandler onloadstart;
|
||||
|
|
|
@ -6,15 +6,12 @@ interface Blob {
|
|||
|
||||
readonly attribute unsigned long long size;
|
||||
readonly attribute DOMString type;
|
||||
readonly attribute boolean isClosed;
|
||||
|
||||
//slice Blob into byte-ranged chunks
|
||||
|
||||
Blob slice([Clamp] optional long long start,
|
||||
[Clamp] optional long long end,
|
||||
optional DOMString contentType);
|
||||
void close();
|
||||
|
||||
};
|
||||
|
||||
dictionary BlobPropertyBag {
|
||||
|
@ -64,7 +61,7 @@ interface FileReader: EventTarget {
|
|||
// File or Blob data
|
||||
readonly attribute (DOMString or ArrayBuffer)? result;
|
||||
|
||||
readonly attribute DOMError? error;
|
||||
readonly attribute DOMException? error;
|
||||
|
||||
// event handler content attributes
|
||||
attribute EventHandler onloadstart;
|
||||
|
|
|
@ -19,28 +19,35 @@
|
|||
assert_equals(readerNoRead.result, null);
|
||||
}, "Aborting before read");
|
||||
|
||||
async_test(function() {
|
||||
var blob = new Blob(["TEST THE ABORT METHOD"]);
|
||||
var readerAbort = new FileReader();
|
||||
promise_test(t => {
|
||||
var blob = new Blob(["TEST THE ABORT METHOD"]);
|
||||
var readerAbort = new FileReader();
|
||||
|
||||
readerAbort.onabort = this.step_func(function(evt) {
|
||||
assert_equals(readerAbort.readyState, readerAbort.DONE);
|
||||
});
|
||||
var eventWatcher = new EventWatcher(t, readerAbort,
|
||||
['abort', 'loadstart', 'loadend', 'error', 'load']);
|
||||
|
||||
readerAbort.onloadstart = this.step_func(function(evt) {
|
||||
assert_equals(readerAbort.readyState, readerAbort.LOADING);
|
||||
readerAbort.abort();
|
||||
});
|
||||
// EventWatcher doesn't let us inspect the state after the abort event,
|
||||
// so add an extra event handler for that.
|
||||
readerAbort.addEventListener('abort', t.step_func(e => {
|
||||
assert_equals(readerAbort.readyState, readerAbort.DONE);
|
||||
}));
|
||||
|
||||
readerAbort.onloadend = this.step_func(function(evt) {
|
||||
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=24401
|
||||
assert_equals(readerAbort.result, null);
|
||||
assert_equals(readerAbort.readyState, readerAbort.DONE);
|
||||
this.done();
|
||||
});
|
||||
|
||||
readerAbort.readAsText(blob);
|
||||
}, "Aborting after read");
|
||||
readerAbort.readAsText(blob);
|
||||
return eventWatcher.wait_for('loadstart')
|
||||
.then(() => {
|
||||
assert_equals(readerAbort.readyState, readerAbort.LOADING);
|
||||
// 'abort' and 'loadend' events are dispatched synchronously, so
|
||||
// call wait_for before calling abort.
|
||||
var nextEvent = eventWatcher.wait_for(['abort', 'loadend']);
|
||||
readerAbort.abort();
|
||||
return nextEvent;
|
||||
})
|
||||
.then(() => {
|
||||
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=24401
|
||||
assert_equals(readerAbort.result, null);
|
||||
assert_equals(readerAbort.readyState, readerAbort.DONE);
|
||||
});
|
||||
}, "Aborting after read");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Relevant/current/blob source page used as a test helper</title>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
document.domain = "{{host}}";
|
||||
</script>
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Incumbent page used as a test helper</title>
|
||||
|
||||
<iframe src="//{{domains[www1]}}:{{location[port]}}/FileAPI/support/document-domain-setter.sub.html" id="c"></iframe>
|
||||
<iframe src="//{{domains[www2]}}:{{location[port]}}/FileAPI/support/document-domain-setter.sub.html" id="r"></iframe>
|
||||
<iframe src="//{{domains[élève]}}:{{location[port]}}/FileAPI/support/document-domain-setter.sub.html" id="bs"></iframe>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
document.domain = "{{host}}";
|
||||
|
||||
window.createBlobURL = () => {
|
||||
const current = document.querySelector("#c").contentWindow;
|
||||
const relevant = document.querySelector("#r").contentWindow;
|
||||
const blobSource = document.querySelector("#bs").contentWindow;
|
||||
|
||||
const blob = new blobSource.Blob(["Test Blob"]);
|
||||
|
||||
return current.URL.createObjectURL.call(relevant, blob);
|
||||
};
|
||||
|
||||
</script>
|
|
@ -0,0 +1,66 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>FileAPI Test: Creating Blob URL with Blob</title>
|
||||
<link rel="author" title="Victor Costan" href="mailto:pwnall@chromium.org">
|
||||
<link rel="help" href="https://w3c.github.io/FileAPI/#originOfBlobURL">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/browsers.html#concept-origin">
|
||||
<link rel="help" href="https://url.spec.whatwg.org/#url-parsing">
|
||||
<link rel="help" href="https://fetch.spec.whatwg.org/#main-fetch">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<style>
|
||||
iframe { width: 10px; height: 10px; }
|
||||
</style>
|
||||
|
||||
<iframe id="unconstrained-iframe"></iframe>
|
||||
<iframe id="sandboxed-iframe" sandbox="allow-scripts"></iframe>
|
||||
|
||||
<script id="iframe-srcdoc" language="text/html">
|
||||
<!doctype html>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
window.onload = () => {
|
||||
const blob = new Blob(['Hello world!']);
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
|
||||
fetch(blobUrl).then(response => response.text()).then(text => {
|
||||
window.parent.postMessage({ blobUrl, text }, '*');
|
||||
});
|
||||
};
|
||||
// The script tag is closed in readBlobFromUrl().
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
// Carries out the test of minting a Blob URL in an iframe, and reading it back.
|
||||
//
|
||||
// Returns a promise resolved with an object with properties blobUrl and text
|
||||
// (the text read back from the Blob URL).
|
||||
function readBlobFromUrl(t, iframeSelector) {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.onmessage = t.step_func((message) => { resolve(message.data); });
|
||||
|
||||
const frame = document.querySelector(iframeSelector);
|
||||
const html = document.querySelector('#iframe-srcdoc').textContent +
|
||||
'<' + '/script>';
|
||||
frame.setAttribute('srcdoc', html);
|
||||
});
|
||||
}
|
||||
|
||||
promise_test(t => readBlobFromUrl(t, '#unconstrained-iframe').then(data => {
|
||||
assert_true(data.blobUrl.startsWith('blob:'),
|
||||
"The Blob's URL should use the blob: scheme");
|
||||
assert_equals(data.text, 'Hello world!',
|
||||
"The result of reading the Blob's URL should be the Blob's contents");
|
||||
}), 'reading a Blob URL in an unconstrained iframe');
|
||||
|
||||
promise_test(t => readBlobFromUrl(t, '#sandboxed-iframe').then(data => {
|
||||
assert_true(data.blobUrl.startsWith('blob:'),
|
||||
"The Blob's URL should use the blob: scheme");
|
||||
assert_equals(data.text, 'Hello world!',
|
||||
"The result of reading the Blob's URL should be the Blob's contents");
|
||||
}), 'reading a Blob URL in a sandboxed iframe without the same-origin flag');
|
||||
|
||||
</script>
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Blob URL serialization (specifically the origin) in multi-global situations</title>
|
||||
<link rel="help" href="https://w3c.github.io/FileAPI/#unicodeBlobURL">
|
||||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
|
||||
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<!-- this page is the entry global -->
|
||||
|
||||
<iframe src="//{{domains[www]}}:{{location[port]}}/FileAPI/support/incumbent.sub.html"></iframe>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
document.domain = "{{host}}";
|
||||
|
||||
window.onload = () => {
|
||||
const url = frames[0].createBlobURL();
|
||||
const desired = "blob:{{location[scheme]}}://www1";
|
||||
assert_equals(url.substring(0, desired.length), desired,
|
||||
"Origin should contain www1, from the current settings object");
|
||||
done();
|
||||
};
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue