Bug 1478116 [wpt PR 12165] - [idlharness.js] Add inheritor as dep for includes, a=testonly

Automatic update from web-platform-tests[idlharness.js] Add inheritor as dep for includes (#12165)

* Fix/simplify tests broken by change
* Remove redundant self object in selection/idlharness.window.js

--

wpt-commits: 2fe1bdb04188923e8933161a46e71718f33f8fdb
wpt-pr: 12165
This commit is contained in:
Luke Bjerring 2018-07-30 14:59:37 +00:00 коммит произвёл moz-wptsync-bot
Родитель a9aa08c5ca
Коммит 3488df0928
10 изменённых файлов: 149 добавлений и 111 удалений

Просмотреть файл

@ -416083,7 +416083,7 @@
"testharness"
],
"WebCryptoAPI/idlharness.https.any.js": [
"20aa40edbafb62b047443402bd8261ab77f9d158",
"f5095cba4f7ac9fcfcb699fdfb7eb95ed170655f",
"testharness"
],
"WebCryptoAPI/import_export/ec_importKey.https.worker.js": [
@ -502427,7 +502427,7 @@
"testharness"
],
"css/css-animations/idlharness.html": [
"9c03c7c07d30bed0ff755dc71549c647cc3d9092",
"b25b97048a4b71cbc22455d2779bf0eec296ffeb",
"testharness"
],
"css/css-animations/pending-style-changes-001.html": [
@ -541487,7 +541487,7 @@
"testharness"
],
"css/css-transitions/idlharness.html": [
"36178b734b95202d46aceddfc86f08165c48f56b",
"6856952cce2053926dfb44447b205d0ad9446572",
"testharness"
],
"css/css-transitions/properties-value-001.html": [
@ -571891,7 +571891,7 @@
"testharness"
],
"fetch/api/idl.any.js": [
"9fd5eccd2cbf75145101f5c3f2c8d16c93977706",
"a3dec797943bb1c2a34d7a09d50273d83178c077",
"testharness"
],
"fetch/api/policies/csp-blocked-worker.html": [
@ -594555,7 +594555,7 @@
"support"
],
"mediacapture-record/idlharness.window.js": [
"d367064b2a5312502df65986465d08dcf85b99b7",
"3b7947430fea4a353dae9c4e422e46370ce08a41",
"testharness"
],
"mediacapture-streams/GUM-api.https.html": [
@ -604679,7 +604679,7 @@
"support"
],
"push-api/idlharness.https.any.js": [
"65f933d724e5e25cb40d87a2aee1044ce9df47fa",
"7ed5e110c56a91d39ea1a6d585709160cc46bf69",
"testharness"
],
"quirks/META.yml": [
@ -613359,7 +613359,7 @@
"testharness"
],
"selection/idlharness.window.js": [
"d7b851d4752a49f030e8070f6b6c516a912c71e8",
"7322a77121a6e64cb5370cdcc98e3ad9efb15ae7",
"testharness"
],
"selection/isCollapsed.html": [
@ -631187,7 +631187,7 @@
"support"
],
"webxr/interfaces.https.html": [
"385f835fdb6aa12ed189638a49929c1c0fdafde4",
"df795ded64ea94bf075a1c8f96f03f97ee618347",
"testharness"
],
"webxr/resources/webxr_check.html": [

Просмотреть файл

@ -3,14 +3,14 @@
// https://w3c.github.io/webcrypto/Overview.html
promise_test(async () => {
const idl = await fetch(`/interfaces/WebCryptoAPI.idl`).then(r => r.text());
const idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_objects({
Crypto: ['crypto'],
SubtleCrypto: ['crypto.subtle']
});
idl_array.test();
}, 'WebCryptoAPI interfaces');
idl_test(
['WebCryptoAPI'],
['html', 'dom'],
idl_array => {
idl_array.add_objects({
Crypto: ['crypto'],
SubtleCrypto: ['crypto.subtle']
});
},
'WebCryptoAPI interfaces'
);

Просмотреть файл

@ -26,7 +26,7 @@
idl_test(
['css-animations'],
['dom', 'cssom'],
['html', 'dom', 'cssom'],
idl_array => {
try {
window.keyframes = document.styleSheets[0].cssRules[0];

Просмотреть файл

@ -8,16 +8,18 @@
<script>
"use strict";
promise_test(async () => {
const idl_array = new IdlArray();
const idl = await fetch("/interfaces/css-transitions.idl").then(r => r.text());
const cssom = await fetch("/interfaces/cssom.idl").then(r => r.text());
const html = await fetch("/interfaces/html.idl").then(r => r.text());
const dom = await fetch("/interfaces/dom.idl").then(r => r.text());
idl_array.add_idls(idl);
idl_array.add_dependency_idls(cssom);
idl_array.add_dependency_idls(html);
idl_array.add_dependency_idls(dom);
idl_array.test();
}, "Test IDL implementation of css-transitions API");
idl_test(
['css-transitions'],
['cssom', 'html', 'dom'],
idl_array => {
idl_array.add_objects({
TransitionEvent: ['new TransitionEvent("transitionend")'],
// These include GlobalEventHandlers
Document: ['document'],
HTMLElement: ['document'],
Window: ['window'],
})
},
'Test IDL implementation of css-transitions API'
);
</script>

Просмотреть файл

@ -2,18 +2,20 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
promise_test(async() => {
const text = await (await fetch("/interfaces/fetch.idl")).text();
const referrer_policy = await (await fetch("/interfaces/referrer-policy.idl")).text();
const idl_array = new IdlArray();
idl_array.add_idls(text);
idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface AbortSignal {};");
idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface ReadableStream {};");
idl_array.add_dependency_idls(referrer_policy);
idl_array.add_objects({
Headers: ["new Headers()"],
Request: ["new Request('about:blank')"],
Response: ["new Response()"],
});
idl_array.test();
}, "Fetch Standard IDL");
idl_test(
['fetch'],
['referrer-policy', 'html', 'dom'],
idl_array => {
idl_array.add_objects({
Headers: ["new Headers()"],
Request: ["new Request('about:blank')"],
Response: ["new Response()"],
});
if (self.GLOBAL.isWindow()) {
idl_array.add_objects({ Window: ['window'] });
} else if (self.GLOBAL.isWorker()) {
idl_array.add_objects({ WorkerGlobalScope: ['self'] });
}
},
'Fetch Standard IDL'
);

Просмотреть файл

@ -7,7 +7,7 @@
idl_test(
['mediastream-recording'],
['mediacapture-main', 'html', 'dom', 'FileAPI'],
['mediacapture-streams', 'FileAPI', 'html', 'dom'],
idl_array => {
// Ignored errors will be surfaced in idlharness.js's test_object below.
let recorder, blob, error;

Просмотреть файл

@ -4,20 +4,19 @@
// https://w3c.github.io/push-api/
promise_test(async () => {
const srcs = [
'push-api',
'service-workers',
'dom',
'html'
];
const [idl, worker, dom, html] = await Promise.all(
srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));
const idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_dependency_idls(worker);
idl_array.add_dependency_idls(dom);
idl_array.add_dependency_idls(html);
idl_array.test();
}, 'push-api interfaces');
idl_test(
['push-api'],
['service-workers', 'html', 'dom'],
idl_array => {
// TODO: ServiceWorkerRegistration objects
if ('ServiceWorkerGlobalScope' in self
&& self instanceof ServiceWorkerGlobalScope) {
idl_array.add_objects({
PushSubscriptionChangeEvent: [
'new PushSubscriptionChangeEvent("pushsubscriptionchange")'
],
})
}
},
'push-api interfaces'
);

Просмотреть файл

@ -299,36 +299,57 @@ IdlArray.prototype.add_dependency_idls = function(raw_idls, options)
// Maps name -> [parsed_idl, ...]
const skipped = new Map();
const process = function(parsed) {
let name = parsed.name
|| parsed.type == "implements" && parsed.target
|| parsed.type == "includes" && parsed.target;
if (!name || should_skip(name) || !all_deps.has(name)) {
name &&
skipped.has(name)
? skipped.get(name).push(parsed)
: skipped.set(name, [parsed]);
return;
var deps = [];
if (parsed.name) {
deps.push(parsed.name);
} else if (parsed.type === "implements") {
deps.push(parsed.target);
deps.push(parsed.implements);
} else if (parsed.type === "includes") {
deps.push(parsed.target);
deps.push(parsed.includes);
}
new_options.only.push(name);
const follow_up = [];
for (const dep_type of ["inheritance", "implements", "includes"]) {
if (parsed[dep_type]) {
const dep = parsed[dep_type];
new_options.only.push(dep);
all_deps.add(dep);
follow_up.push(dep);
deps = deps.filter(function(name) {
if (!name || should_skip(name) || !all_deps.has(name)) {
// Flag as skipped, if it's not already processed, so we can
// come back to it later if we retrospectively call it a dep.
if (name && !(name in this.members)) {
skipped.has(name)
? skipped.get(name).push(parsed)
: skipped.set(name, [parsed]);
}
return false;
}
}
return true;
}.bind(this));
for (const deferred of follow_up) {
if (skipped.has(deferred)) {
const next = skipped.get(deferred);
skipped.delete(deferred);
next.forEach(process);
deps.forEach(function(name) {
new_options.only.push(name);
const follow_up = new Set();
for (const dep_type of ["inheritance", "implements", "includes"]) {
if (parsed[dep_type]) {
const inheriting = parsed[dep_type];
const inheritor = parsed.name || parsed.target;
for (const dep of [inheriting, inheritor]) {
new_options.only.push(dep);
all_deps.add(dep);
follow_up.add(dep);
}
}
}
}
}
for (const deferred of follow_up) {
if (skipped.has(deferred)) {
const next = skipped.get(deferred);
skipped.delete(deferred);
next.forEach(process);
}
}
});
}.bind(this);
for (let parsed of parsed_idls) {
process(parsed);
}
@ -370,8 +391,13 @@ IdlArray.prototype.internal_add_idls = function(parsed_idls, options)
parsed_idls.forEach(function(parsed_idl)
{
if (parsed_idl.partial
&& ["interface", "dictionary", "namespace"].includes(parsed_idl.type))
var partial_types = [
"interface",
"interface mixin",
"dictionary",
"namespace",
];
if (parsed_idl.partial && partial_types.includes(parsed_idl.type))
{
if (should_skip(parsed_idl.name))
{
@ -3183,9 +3209,7 @@ function idl_test(srcs, deps, idl_setup_func, test_name) {
deps = (deps instanceof Array) ? deps : [deps] || [];
return Promise.all(
srcs.concat(deps).map(function(spec) {
return fetch('/interfaces/' + spec + '.idl').then(function(r) {
return r.text();
});
return fetch_spec(spec);
}))
.then(function(idls) {
for (var i = 0; i < srcs.length; i++) {
@ -3202,9 +3226,24 @@ function idl_test(srcs, deps, idl_setup_func, test_name) {
})
.then(function() { idl_array.test(); })
.catch(function (reason) {
idl_array.test(); // Test what we can.
try {
idl_array.test(); // Test what we can.
} catch (e) {
// If testing fails hard here, the original setup error
// is more likely to be the real cause.
reason = reason || e;
}
return Promise.reject(reason || 'IDL setup failed.');
});
}, test_name);
}
/**
* fetch_spec is a shorthand for a Promise that fetches the spec's content.
*/
function fetch_spec(spec) {
return fetch('/interfaces/' + spec + '.idl').then(function (r) {
return r.text();
});
}
// vim: set expandtab shiftwidth=4 tabstop=4 foldmarker=@{,@} foldmethod=marker:

Просмотреть файл

@ -13,7 +13,6 @@ idl_test(
Window: ['window'],
Document: ['document'],
Selection: ['getSelection()'],
GlobalEventHandlers: ['self'],
});
},
'selection-api interfaces'

Просмотреть файл

@ -9,18 +9,15 @@
<script>
"use strict";
promise_test(async () => {
const idl_array = new IdlArray();
const dom_idl = await fetch("/interfaces/dom.idl").then(r => r.text());
const webxr_idl = await fetch("/interfaces/webxr.idl").then(r => r.text());
idl_array.add_untested_idls(dom_idl);
idl_array.add_untested_idls("interface Navigator {};");
idl_array.add_idls(webxr_idl);
idl_array.add_idls("dictionary WebGLContextAttributes {};");
idl_array.add_objects({
Navigator:['navigator'],
});
idl_array.test();
}, "Test IDL implementation of WebXR API");
idl_test(
['webxr'],
['html', 'dom'],
idl_array => {
idl_array.add_untested_idls("dictionary WebGLContextAttributes {};");
idl_array.add_untested_idls("interface WebGLRenderingContextBase {};");
idl_array.add_objects({
Navigator:['navigator'],
});
},
'Test IDL implementation of WebXR API');
</script>