diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 8de69580cddb..48d4c9ea1d75 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -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": [ diff --git a/testing/web-platform/tests/WebCryptoAPI/idlharness.https.any.js b/testing/web-platform/tests/WebCryptoAPI/idlharness.https.any.js index 20aa40edbafb..f5095cba4f7a 100644 --- a/testing/web-platform/tests/WebCryptoAPI/idlharness.https.any.js +++ b/testing/web-platform/tests/WebCryptoAPI/idlharness.https.any.js @@ -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' +); diff --git a/testing/web-platform/tests/css/css-animations/idlharness.html b/testing/web-platform/tests/css/css-animations/idlharness.html index 9c03c7c07d30..b25b97048a4b 100644 --- a/testing/web-platform/tests/css/css-animations/idlharness.html +++ b/testing/web-platform/tests/css/css-animations/idlharness.html @@ -26,7 +26,7 @@ idl_test( ['css-animations'], - ['dom', 'cssom'], + ['html', 'dom', 'cssom'], idl_array => { try { window.keyframes = document.styleSheets[0].cssRules[0]; diff --git a/testing/web-platform/tests/css/css-transitions/idlharness.html b/testing/web-platform/tests/css/css-transitions/idlharness.html index 36178b734b95..6856952cce20 100644 --- a/testing/web-platform/tests/css/css-transitions/idlharness.html +++ b/testing/web-platform/tests/css/css-transitions/idlharness.html @@ -8,16 +8,18 @@ diff --git a/testing/web-platform/tests/fetch/api/idl.any.js b/testing/web-platform/tests/fetch/api/idl.any.js index 9fd5eccd2cbf..a3dec797943b 100644 --- a/testing/web-platform/tests/fetch/api/idl.any.js +++ b/testing/web-platform/tests/fetch/api/idl.any.js @@ -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' +); diff --git a/testing/web-platform/tests/mediacapture-record/idlharness.window.js b/testing/web-platform/tests/mediacapture-record/idlharness.window.js index d367064b2a53..3b7947430fea 100644 --- a/testing/web-platform/tests/mediacapture-record/idlharness.window.js +++ b/testing/web-platform/tests/mediacapture-record/idlharness.window.js @@ -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; diff --git a/testing/web-platform/tests/push-api/idlharness.https.any.js b/testing/web-platform/tests/push-api/idlharness.https.any.js index 65f933d724e5..7ed5e110c56a 100644 --- a/testing/web-platform/tests/push-api/idlharness.https.any.js +++ b/testing/web-platform/tests/push-api/idlharness.https.any.js @@ -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' +); diff --git a/testing/web-platform/tests/resources/idlharness.js b/testing/web-platform/tests/resources/idlharness.js index bc1b14c31591..e131f05f1073 100644 --- a/testing/web-platform/tests/resources/idlharness.js +++ b/testing/web-platform/tests/resources/idlharness.js @@ -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: diff --git a/testing/web-platform/tests/selection/idlharness.window.js b/testing/web-platform/tests/selection/idlharness.window.js index d7b851d4752a..7322a77121a6 100644 --- a/testing/web-platform/tests/selection/idlharness.window.js +++ b/testing/web-platform/tests/selection/idlharness.window.js @@ -13,7 +13,6 @@ idl_test( Window: ['window'], Document: ['document'], Selection: ['getSelection()'], - GlobalEventHandlers: ['self'], }); }, 'selection-api interfaces' diff --git a/testing/web-platform/tests/webxr/interfaces.https.html b/testing/web-platform/tests/webxr/interfaces.https.html index 385f835fdb6a..df795ded64ea 100644 --- a/testing/web-platform/tests/webxr/interfaces.https.html +++ b/testing/web-platform/tests/webxr/interfaces.https.html @@ -9,18 +9,15 @@