diff options
author | Filip Skokan <panva.ip@gmail.com> | 2023-03-15 14:03:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-15 14:03:07 +0100 |
commit | 72ced378212b5d3f648c850b304036dfd3614ffe (patch) | |
tree | 6614b1ea27fa91f9b391f8820a6515d4c2630d55 | |
parent | 51649272bd388f14685a47cfe805bd9cdb602240 (diff) |
fix(wpt): set META_TITLE on global for the testharness (#18193)
Fixes hopefully the last mismatch of reported test titles.
-
[redirect-schemes.any.html](https://wpt.fyi/results/fetch/api/redirect/redirect-schemes.any.html?run_id=5139017526411264&run_id=5093839906275328)
-
[redirect-schemes.any.worker.html](https://wpt.fyi/results/fetch/api/redirect/redirect-schemes.any.worker.html?run_id=5139017526411264&run_id=5093839906275328)
-
https://github.com/web-platform-tests/wpt/blob/ebf6814ebdf36a551563a34a4396f4f2b3b1f617/resources/testharness.js#L4754-L4756
-rw-r--r-- | tools/wpt/runner.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/wpt/runner.ts b/tools/wpt/runner.ts index 7e15216be..dffeacae1 100644 --- a/tools/wpt/runner.ts +++ b/tools/wpt/runner.ts @@ -180,8 +180,14 @@ async function generateBundle(location: URL): Promise<string> { const doc = new DOMParser().parseFromString(body, "text/html"); assert(doc, "document should have been parsed"); const scripts = doc.getElementsByTagName("script"); + const title = doc.getElementsByTagName("title")[0]?.childNodes[0].nodeValue; const scriptContents = []; let inlineScriptCount = 0; + if (title) { + const url = new URL(`#${inlineScriptCount}`, location); + inlineScriptCount++; + scriptContents.push([url.href, `globalThis.META_TITLE="${title}"`]); + } for (const script of scripts) { const src = script.getAttribute("src"); if (src === "/resources/testharnessreport.js") { |