Tests: Always load WPT interfaces from root interfaces directory

Previously we would load from "../interfaces" which wouldn't work for
nested tests.
This commit is contained in:
Callum Law 2025-07-11 17:01:39 +12:00 committed by Jelle Raaijmakers
commit fc395f9824
Notes: github-actions[bot] 2025-07-11 08:58:59 +00:00

View file

@ -3557,7 +3557,12 @@ globalThis.idl_test = idl_test;
* Note: ShadowRealm-specific implementation in testharness-shadowrealm-inner.js * Note: ShadowRealm-specific implementation in testharness-shadowrealm-inner.js
*/ */
function fetch_spec(spec) { function fetch_spec(spec) {
var url = '../interfaces/' + spec + '.idl'; const url_parts = window.location.href.split("/");
while (url_parts[url_parts.length - 1] != "wpt-import")
url_parts.pop();
var url = url_parts.join("/") + '/interfaces/' + spec + '.idl';
return fetch(url).then(function (r) { return fetch(url).then(function (r) {
if (!r.ok) { if (!r.ok) {
throw new IdlHarnessError("Error fetching " + url + "."); throw new IdlHarnessError("Error fetching " + url + ".");