mirror of
https://github.com/denoland/deno.git
synced 2024-12-21 23:04:45 -05:00
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)
-
ebf6814ebd/resources/testharness.js (L4754-L4756)
This commit is contained in:
parent
51649272bd
commit
72ced37821
1 changed files with 6 additions and 0 deletions
|
@ -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") {
|
||||
|
|
Loading…
Reference in a new issue