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 — lib: support more attributes for early hint link · nodejs/node@f412834

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal
    • validators.js
  • test/parallel
    • test-validators.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/validators.js‎

Copy file name to clipboardExpand all lines: lib/internal/validators.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ function validateUnion(value, name, union) {
441441
}
442442
}
443443

444-
const linkValueRegExp = /^(?:<[^>]*>;)\s*(?:rel=(")?[^;"]*\1;?)\s*(?:(?:as|anchor|title)=(")?[^;"]*\2)?$/;
444+
const linkValueRegExp = /^(?:<[^>]*>;)\s*(?:rel=(")?[^;"]*\1;?)\s*(?:(?:as|anchor|title|crossorigin|disabled|fetchpriority|rel|referrerpolicy)=(")?[^;"]*\2)?$/;
445445

446446
/**
447447
* @param {any} value
Collapse file

‎test/parallel/test-validators.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-validators.js
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const {
1212
validateString,
1313
validateInt32,
1414
validateUint32,
15+
validateLinkHeaderValue,
1516
} = require('internal/validators');
1617
const { MAX_SAFE_INTEGER, MIN_SAFE_INTEGER } = Number;
1718
const outOfRangeError = {
@@ -154,3 +155,15 @@ const invalidArgValueError = {
154155
code: 'ERR_INVALID_ARG_TYPE'
155156
}));
156157
}
158+
159+
{
160+
// validateLinkHeaderValue type validation.
161+
[
162+
['</styles.css>; rel=preload; as=style', '</styles.css>; rel=preload; as=style'],
163+
['</styles.css>; rel=preload; title=hello', '</styles.css>; rel=preload; title=hello'],
164+
['</styles.css>; rel=preload; crossorigin=hello', '</styles.css>; rel=preload; crossorigin=hello'],
165+
['</styles.css>; rel=preload; disabled=true', '</styles.css>; rel=preload; disabled=true'],
166+
['</styles.css>; rel=preload; fetchpriority=high', '</styles.css>; rel=preload; fetchpriority=high'],
167+
['</styles.css>; rel=preload; referrerpolicy=origin', '</styles.css>; rel=preload; referrerpolicy=origin'],
168+
].forEach(([value, expected]) => assert.strictEqual(validateLinkHeaderValue(value), expected));
169+
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — 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.