1
0
Fork 0
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:
Filip Skokan 2023-03-15 14:03:07 +01:00 committed by GitHub
parent 51649272bd
commit 72ced37821
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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") {