Skip to content

Commit

Permalink
fix(wpt): set META_TITLE on global for the testharness (#18193)
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Mar 15, 2023
1 parent 5164927 commit 72ced37
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/wpt/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down

0 comments on commit 72ced37

Please sign in to comment.