GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: pass URL's toascii.window.js WPT · nodejs/node@af4e682

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test
    • common
      • wpt.js
    • wpt
      • status
        • url.json
      • test-url.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/common/wpt.js‎

Copy file name to clipboardExpand all lines: test/common/wpt.js
+19-5Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ class WPTRunner {
301301
this.inProgress = new Set();
302302
this.workers = new Map();
303303
this.unexpectedFailures = [];
304+
305+
this.scriptsModifier = null;
304306
}
305307

306308
/**
@@ -319,6 +321,14 @@ class WPTRunner {
319321
this.initScript = script;
320322
}
321323

324+
/**
325+
* Set the scripts modifier for each script.
326+
* @param {(meta: { code: string, filename: string }) => void}
327+
*/
328+
setScriptModifier(modifier) {
329+
this.scriptsModifier = modifier;
330+
}
331+
322332
get fullInitScript() {
323333
if (this.initScript === null && this.dummyGlobalThisScript === null) {
324334
return null;
@@ -330,7 +340,7 @@ class WPTRunner {
330340
return this.initScript;
331341
}
332342

333-
return `${this.fullInitScript}\n\n//===\n${this.initScript}`;
343+
return `${this.dummyGlobalThisScript}\n\n//===\n${this.initScript}`;
334344
}
335345

336346
/**
@@ -387,17 +397,21 @@ class WPTRunner {
387397
// Scripts specified with the `// META: script=` header
388398
if (meta.script) {
389399
for (const script of meta.script) {
390-
scriptsToRun.push({
400+
const obj = {
391401
filename: this.resource.toRealFilePath(relativePath, script),
392402
code: this.resource.read(relativePath, script, false)
393-
});
403+
};
404+
this.scriptsModifier?.(obj);
405+
scriptsToRun.push(obj);
394406
}
395407
}
396408
// The actual test
397-
scriptsToRun.push({
409+
const obj = {
398410
code: content,
399411
filename: absolutePath
400-
});
412+
};
413+
this.scriptsModifier?.(obj);
414+
scriptsToRun.push(obj);
401415

402416
const workerPath = path.join(__dirname, 'wpt/worker.js');
403417
const worker = new Worker(workerPath, {
Collapse file

‎test/wpt/status/url.json‎

Copy file name to clipboardExpand all lines: test/wpt/status/url.json
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"toascii.window.js": {
3-
"requires": ["small-icu"],
4-
"skip": "TODO: port from .window.js"
3+
"requires": ["small-icu"]
54
},
65
"percent-encoding.window.js": {
76
"requires": ["small-icu"],
Collapse file

‎test/wpt/test-url.js‎

Copy file name to clipboardExpand all lines: test/wpt/test-url.js
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,13 @@ runner.setInitScript(`
1515
global.DOMException = DOMException;
1616
`);
1717

18+
runner.setScriptModifier((obj) => {
19+
if (obj.filename.includes('toascii.window.js')) {
20+
// `a` and `area` in `toascii.window.js` is for testing `Element` that
21+
// created via `document.createElement`. So we need to ignore them and just
22+
// test `URL`.
23+
obj.code = obj.code.replace(/\["url", "a", "area"\]/, '[ "url" ]');
24+
}
25+
});
1826
runner.pretendGlobalThisAs('Window');
1927
runner.runJsTests();

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.