| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -441,7 +441,7 @@ function validateUnion(value, name, union) { | |||
| 441 | 441 | } | |
| 442 | 442 | } | |
| 443 | 443 | ||
| 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)?$/; | ||
| 445 | 445 | ||
| 446 | 446 | /** | |
| 447 | 447 | * @param {any} value | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,6 +12,7 @@ const { | |||
| 12 | 12 | validateString, | |
| 13 | 13 | validateInt32, | |
| 14 | 14 | validateUint32, | |
| 15 | + validateLinkHeaderValue, | ||
| 15 | 16 | } = require('internal/validators'); | |
| 16 | 17 | const { MAX_SAFE_INTEGER, MIN_SAFE_INTEGER } = Number; | |
| 17 | 18 | const outOfRangeError = { | |
@@ -154,3 +155,15 @@ const invalidArgValueError = { | |||
| 154 | 155 | code: 'ERR_INVALID_ARG_TYPE' | |
| 155 | 156 | })); | |
| 156 | 157 | } | |
| 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 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments