mirror of
https://github.com/servo/servo.git
synced 2025-09-03 19:48:21 +01:00
Update web-platform-tests to revision 8a2ceb5f18911302b7a5c1cd2791f4ab50ad4326
This commit is contained in:
parent
462c272380
commit
1f531f66ea
5377 changed files with 174916 additions and 84369 deletions
|
@ -0,0 +1 @@
|
|||
// Do nothing.
|
|
@ -0,0 +1 @@
|
|||
import './import-cyclic-worklet-script.js';
|
|
@ -0,0 +1 @@
|
|||
import './empty-worklet-script.js';
|
|
@ -0,0 +1 @@
|
|||
import './import-nested-internal-worklet-script.js';
|
114
tests/wpt/web-platform-tests/worklets/resources/import-tests.js
Normal file
114
tests/wpt/web-platform-tests/worklets/resources/import-tests.js
Normal file
|
@ -0,0 +1,114 @@
|
|||
// Runs a series of tests related to importing scripts on a worklet.
|
||||
//
|
||||
// Usage:
|
||||
// runImportTests(workletType);
|
||||
function runImportTests(worklet) {
|
||||
promise_test(() => {
|
||||
const kScriptURL = 'resources/empty-worklet-script.js';
|
||||
return worklet.addModule(kScriptURL).then(undefined_arg => {
|
||||
assert_equals(undefined_arg, undefined,
|
||||
'Promise should resolve with no arguments.');
|
||||
});
|
||||
}, 'Importing a script resolves the given promise.');
|
||||
|
||||
promise_test(() => {
|
||||
const kScriptURL = 'resources/empty-worklet-script.js';
|
||||
return Promise.all([
|
||||
worklet.addModule(kScriptURL + '?1'),
|
||||
worklet.addModule(kScriptURL + '?2'),
|
||||
worklet.addModule(kScriptURL + '?3')
|
||||
]).then(undefined_args => {
|
||||
assert_array_equals(undefined_args,
|
||||
[undefined, undefined, undefined],
|
||||
'Promise should resolve with no arguments.');
|
||||
});
|
||||
}, 'Importing scripts resolves all the given promises.');
|
||||
|
||||
promise_test(() => {
|
||||
const kScriptURL = 'resources/import-nested-worklet-script.js';
|
||||
return worklet.addModule(kScriptURL).then(undefined_arg => {
|
||||
assert_equals(undefined_arg, undefined,
|
||||
'Promise should resolve with no arguments.');
|
||||
});
|
||||
}, 'Importing nested scripts resolves the given promise');
|
||||
|
||||
promise_test(() => {
|
||||
const kScriptURL = 'resources/import-cyclic-worklet-script.js';
|
||||
return worklet.addModule(kScriptURL).then(undefined_arg => {
|
||||
assert_equals(undefined_arg, undefined,
|
||||
'Promise should resolve with no arguments.');
|
||||
});
|
||||
}, 'Importing cyclic scripts resolves the given promise');
|
||||
|
||||
promise_test(() => {
|
||||
const kScriptURL = 'resources/throwing-worklet-script.js';
|
||||
return worklet.addModule(kScriptURL).then(undefined_arg => {
|
||||
assert_equals(undefined_arg, undefined,
|
||||
'Promise should resolve with no arguments.');
|
||||
});
|
||||
}, 'Importing a script which throws should still resolve the given ' +
|
||||
'promise.');
|
||||
|
||||
promise_test(t => {
|
||||
const kScriptURL = 'non-existent-worklet-script.js';
|
||||
return promise_rejects(t, new DOMException('', 'AbortError'),
|
||||
worklet.addModule(kScriptURL));
|
||||
}, 'Importing a non-existent script rejects the given promise with an ' +
|
||||
'AbortError.');
|
||||
|
||||
promise_test(t => {
|
||||
const kInvalidScriptURL = 'http://invalid:123$'
|
||||
return promise_rejects(t, new DOMException('', 'SyntaxError'),
|
||||
worklet.addModule(kInvalidScriptURL));
|
||||
}, 'Importing an invalid URL should reject the given promise with a ' +
|
||||
'SyntaxError.');
|
||||
|
||||
promise_test(() => {
|
||||
const kBlob = new Blob([""], {type: 'text/javascript'});
|
||||
const kBlobURL = URL.createObjectURL(kBlob);
|
||||
return worklet.addModule(kBlobURL).then(undefined_arg => {
|
||||
assert_equals(undefined_arg, undefined);
|
||||
});
|
||||
}, 'Importing a blob URL should resolve the given promise.');
|
||||
|
||||
promise_test(t => {
|
||||
const kFileURL = 'file:///empty-worklet-script.js';
|
||||
return promise_rejects(t, new DOMException('', 'AbortError'),
|
||||
worklet.addModule(kFileURL));
|
||||
}, 'Importing a file:// URL should reject the given promise.');
|
||||
|
||||
promise_test(() => {
|
||||
const kDataURL = 'data:text/javascript, // Do nothing.';
|
||||
return worklet.addModule(kDataURL).then(undefined_arg => {
|
||||
assert_equals(undefined_arg, undefined);
|
||||
});
|
||||
}, 'Importing a data URL should resolve the given promise.');
|
||||
|
||||
promise_test(t => {
|
||||
const kScriptURL = 'about:blank';
|
||||
return promise_rejects(t, new DOMException('', 'AbortError'),
|
||||
worklet.addModule(kScriptURL));
|
||||
}, 'Importing about:blank should reject the given promise.');
|
||||
|
||||
promise_test(() => {
|
||||
// Specify the Access-Control-Allow-Origin header to enable cross origin
|
||||
// access.
|
||||
const kScriptURL = get_host_info().HTTP_REMOTE_ORIGIN +
|
||||
'/worklets/resources/empty-worklet-script.js' +
|
||||
'?pipe=header(Access-Control-Allow-Origin, *)';
|
||||
return worklet.addModule(kScriptURL).then(undefined_arg => {
|
||||
assert_equals(undefined_arg, undefined);
|
||||
});
|
||||
}, 'Importing a cross origin resource with the ' +
|
||||
'Access-Control-Allow-Origin header should resolve the given promise');
|
||||
|
||||
promise_test(t => {
|
||||
// Don't specify the Access-Control-Allow-Origin header. addModule()
|
||||
// should be rejected because of disallowed cross origin access.
|
||||
const kScriptURL = get_host_info().HTTP_REMOTE_ORIGIN +
|
||||
'/worklets/resources/empty-worklet-script.js';
|
||||
return promise_rejects(t, new DOMException('', 'AbortError'),
|
||||
worklet.addModule(kScriptURL));
|
||||
}, 'Importing a cross origin resource without the ' +
|
||||
'Access-Control-Allow-Origin header should reject the given promise');
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
throw Error();
|
Loading…
Add table
Add a link
Reference in a new issue