mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
Update web-platform-tests to revision 66f38302334f162d363afcf4a1792d895072f3ef
This commit is contained in:
parent
36f5b69224
commit
b198cd722a
622 changed files with 3374 additions and 2001 deletions
5
tests/wpt/web-platform-tests/FileAPI/META.yml
Normal file
5
tests/wpt/web-platform-tests/FileAPI/META.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
suggested_reviewers:
|
||||
- inexorabletash
|
||||
- zqzhang
|
||||
- jdm
|
||||
- mkruisselbrink
|
|
@ -1,4 +0,0 @@
|
|||
@inexorabletash
|
||||
@zqzhang
|
||||
@jdm
|
||||
@mkruisselbrink
|
|
@ -27,117 +27,6 @@
|
|||
|
||||
<div id="log"></div>
|
||||
|
||||
<pre id="untested_idl" style="display: none">
|
||||
interface ArrayBuffer {
|
||||
};
|
||||
|
||||
interface ArrayBufferView {
|
||||
};
|
||||
|
||||
interface URL {
|
||||
};
|
||||
|
||||
interface EventTarget {
|
||||
};
|
||||
|
||||
interface Event {
|
||||
};
|
||||
|
||||
[TreatNonCallableAsNull]
|
||||
callback EventHandlerNonNull = any (Event event);
|
||||
typedef EventHandlerNonNull? EventHandler;
|
||||
</pre>
|
||||
|
||||
<pre id="idl" style="display: none">
|
||||
[Constructor,
|
||||
Constructor(sequence<(ArrayBuffer or ArrayBufferView or Blob or DOMString)> blobParts, optional BlobPropertyBag options), Exposed=Window,Worker]
|
||||
interface Blob {
|
||||
|
||||
readonly attribute unsigned long long size;
|
||||
readonly attribute DOMString type;
|
||||
|
||||
//slice Blob into byte-ranged chunks
|
||||
|
||||
Blob slice([Clamp] optional long long start,
|
||||
[Clamp] optional long long end,
|
||||
optional DOMString contentType);
|
||||
};
|
||||
|
||||
dictionary BlobPropertyBag {
|
||||
DOMString type = "";
|
||||
};
|
||||
|
||||
[Constructor(sequence<(Blob or DOMString or ArrayBufferView or ArrayBuffer)> fileBits,
|
||||
[EnsureUTF16] DOMString fileName, optional FilePropertyBag options), Exposed=Window,Worker]
|
||||
interface File : Blob {
|
||||
|
||||
readonly attribute DOMString name;
|
||||
readonly attribute long long lastModified;
|
||||
|
||||
};
|
||||
|
||||
dictionary FilePropertyBag {
|
||||
|
||||
DOMString type = "";
|
||||
long long lastModified;
|
||||
|
||||
};
|
||||
|
||||
[Exposed=Window,Worker] interface FileList {
|
||||
getter File? item(unsigned long index);
|
||||
readonly attribute unsigned long length;
|
||||
};
|
||||
|
||||
[Constructor, Exposed=Window,Worker]
|
||||
interface FileReader: EventTarget {
|
||||
|
||||
// async read methods
|
||||
void readAsArrayBuffer(Blob blob);
|
||||
void readAsText(Blob blob, optional DOMString label);
|
||||
void readAsDataURL(Blob blob);
|
||||
|
||||
void abort();
|
||||
|
||||
// states
|
||||
const unsigned short EMPTY = 0;
|
||||
const unsigned short LOADING = 1;
|
||||
const unsigned short DONE = 2;
|
||||
|
||||
readonly attribute unsigned short readyState;
|
||||
|
||||
// File or Blob data
|
||||
readonly attribute (DOMString or ArrayBuffer)? result;
|
||||
|
||||
readonly attribute DOMException? error;
|
||||
|
||||
// event handler attributes
|
||||
attribute EventHandler onloadstart;
|
||||
attribute EventHandler onprogress;
|
||||
attribute EventHandler onload;
|
||||
attribute EventHandler onabort;
|
||||
attribute EventHandler onerror;
|
||||
attribute EventHandler onloadend;
|
||||
|
||||
};
|
||||
|
||||
[Constructor, Exposed=Worker]
|
||||
interface FileReaderSync {
|
||||
|
||||
// Synchronously return strings
|
||||
|
||||
ArrayBuffer readAsArrayBuffer(Blob blob);
|
||||
DOMString readAsText(Blob blob, optional DOMString label);
|
||||
DOMString readAsDataURL(Blob blob);
|
||||
};
|
||||
|
||||
partial interface URL {
|
||||
|
||||
static DOMString createObjectURL(Blob blob);
|
||||
static void revokeObjectURL(DOMString url);
|
||||
|
||||
};
|
||||
</pre>
|
||||
|
||||
<script>
|
||||
var fileInput;
|
||||
|
||||
|
@ -145,10 +34,18 @@ partial interface URL {
|
|||
fileInput = document.querySelector("#fileChooser")
|
||||
}, {explicit_done: true, explicit_timeout: true});
|
||||
|
||||
on_event(fileInput, "change", function(evt) {
|
||||
var idl_array = new IdlArray();
|
||||
idl_array.add_untested_idls(document.getElementById("untested_idl").textContent);
|
||||
idl_array.add_idls(document.getElementById("idl").textContent);
|
||||
on_event(fileInput, "change", async function(evt) {
|
||||
const idl = await fetch('/interfaces/FileAPI.idl').then(r => r.text());
|
||||
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
|
||||
const html = await fetch('/interfaces/html.idl').then(r => r.text());
|
||||
const url = await fetch('/interfaces/url.idl').then(r => r.text());
|
||||
|
||||
const idl_array = new IdlArray();
|
||||
idl_array.add_idls(idl);
|
||||
idl_array.add_dependency_idls(url);
|
||||
idl_array.add_dependency_idls(html);
|
||||
idl_array.add_dependency_idls(dom);
|
||||
idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface ArrayBuffer {};");
|
||||
|
||||
idl_array.add_objects({
|
||||
FileList: [fileInput.files],
|
||||
|
|
|
@ -20,37 +20,30 @@
|
|||
</form>
|
||||
|
||||
<script>
|
||||
var file_input;
|
||||
setup(function() {
|
||||
var idl_array = new IdlArray();
|
||||
'use strict';
|
||||
|
||||
var request = new XMLHttpRequest();
|
||||
request.open("GET", "/interfaces/FileAPI.idl");
|
||||
request.send();
|
||||
request.onload = function() {
|
||||
var idls = request.responseText;
|
||||
promise_test(async () => {
|
||||
const idl = await fetch('/interfaces/FileAPI.idl').then(r => r.text());
|
||||
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
|
||||
const html = await fetch('/interfaces/html.idl').then(r => r.text());
|
||||
const url = await fetch('/interfaces/url.idl').then(r => r.text());
|
||||
|
||||
const idl_array = new IdlArray();
|
||||
idl_array.add_idls(idl);
|
||||
idl_array.add_dependency_idls(url);
|
||||
idl_array.add_dependency_idls(html);
|
||||
idl_array.add_dependency_idls(dom);
|
||||
idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface ArrayBuffer {};");
|
||||
idl_array.add_untested_idls("interface URL {};");
|
||||
idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface EventTarget {};");
|
||||
idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface Event {};");
|
||||
idl_array.add_untested_idls("[TreatNonCallableAsNull] callback EventHandlerNonNull = any (Event event);");
|
||||
idl_array.add_untested_idls("typedef EventHandlerNonNull? EventHandler;");
|
||||
|
||||
idl_array.add_idls(idls);
|
||||
|
||||
file_input = document.querySelector("#fileChooser");
|
||||
idl_array.add_objects({
|
||||
Blob: ['new Blob(["TEST"])'],
|
||||
File: ['new File(["myFileBits"], "myFileName")'],
|
||||
FileList: ['file_input.files'],
|
||||
FileReader: ['new FileReader()']
|
||||
Blob: ['new Blob(["TEST"])'],
|
||||
File: ['new File(["myFileBits"], "myFileName")'],
|
||||
FileList: ['document.querySelector("#fileChooser").files'],
|
||||
FileReader: ['new FileReader()']
|
||||
});
|
||||
|
||||
idl_array.test();
|
||||
done();
|
||||
};
|
||||
}, {explicit_done: true});
|
||||
}, 'Test FileAPI IDL implementation');
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
|
@ -1,31 +1,25 @@
|
|||
importScripts("/resources/testharness.js");
|
||||
importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js");
|
||||
|
||||
var request = new XMLHttpRequest();
|
||||
request.open("GET", "/interfaces/FileAPI.idl");
|
||||
request.send();
|
||||
request.onload = function() {
|
||||
var idl_array = new IdlArray();
|
||||
var idls = request.responseText;
|
||||
promise_test(async () => {
|
||||
const idl = await fetch('/interfaces/FileAPI.idl').then(r => r.text());
|
||||
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
|
||||
const html = await fetch('/interfaces/html.idl').then(r => r.text());
|
||||
const url = await fetch('/interfaces/url.idl').then(r => r.text());
|
||||
|
||||
idl_array.add_untested_idls("[Global] interface Window { };");
|
||||
const idl_array = new IdlArray();
|
||||
idl_array.add_idls(idl);
|
||||
idl_array.add_dependency_idls(dom);
|
||||
idl_array.add_dependency_idls(html);
|
||||
idl_array.add_dependency_idls(url);
|
||||
idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface ArrayBuffer {};");
|
||||
idl_array.add_objects({
|
||||
Blob: ['new Blob(["TEST"])'],
|
||||
File: ['new File(["myFileBits"], "myFileName")'],
|
||||
FileReader: ['new FileReader()'],
|
||||
FileReaderSync: ['new FileReaderSync()']
|
||||
});
|
||||
|
||||
idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface ArrayBuffer {};");
|
||||
idl_array.add_untested_idls("interface URL {};");
|
||||
idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface EventTarget {};");
|
||||
idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface Event {};");
|
||||
idl_array.add_untested_idls("[TreatNonCallableAsNull] callback EventHandlerNonNull = any (Event event);");
|
||||
idl_array.add_untested_idls("typedef EventHandlerNonNull? EventHandler;");
|
||||
|
||||
idl_array.add_idls(idls);
|
||||
|
||||
idl_array.add_objects({
|
||||
Blob: ['new Blob(["TEST"])'],
|
||||
File: ['new File(["myFileBits"], "myFileName")'],
|
||||
FileReader: ['new FileReader()'],
|
||||
FileReaderSync: ['new FileReaderSync()']
|
||||
});
|
||||
|
||||
idl_array.test();
|
||||
done();
|
||||
};
|
||||
idl_array.test();
|
||||
}, 'Test FileAPI IDL implementation');
|
||||
done();
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
self.addEventListener('message', e => {
|
||||
URL.revokeObjectURL(e.data.url);
|
||||
// Registering a new object URL will make absolutely sure that the revocation
|
||||
// has propagated. Without this at least in chrome it is possible for the
|
||||
// below postMessage to arrive at its destination before the revocation has
|
||||
// been fully processed.
|
||||
URL.createObjectURL(new Blob([]));
|
||||
self.postMessage('revoked');
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue