Skip to content

Commit 46c6eea

Browse files
committed
revert
1 parent 70a06cf commit 46c6eea

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

lib/web/fetch/constants.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,6 @@ const requestDuplex = /** @type {const} */ ([
8484
'half'
8585
])
8686

87-
/**
88-
* A local scheme is "about", "blob", or "data".
89-
*
90-
* @see https://fetch.spec.whatwg.org/#local-scheme
91-
*/
92-
const urlLocalScheme = /** @type {const} */ ([
93-
'about:',
94-
'blob:',
95-
'data:'
96-
])
97-
9887
/**
9988
* @see http://fetch.spec.whatwg.org/#forbidden-method
10089
*/
@@ -138,6 +127,5 @@ module.exports = {
138127
corsSafeListedMethodsSet,
139128
safeMethodsSet,
140129
forbiddenMethodsSet,
141-
referrerPolicyTokens: referrerPolicyTokensSet,
142-
urlLocalScheme
130+
referrerPolicyTokens: referrerPolicyTokensSet
143131
}

lib/web/fetch/util.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const { Transform } = require('node:stream')
44
const zlib = require('node:zlib')
5-
const { redirectStatusSet, referrerPolicyTokens, badPortsSet, urlLocalScheme } = require('./constants')
5+
const { redirectStatusSet, referrerPolicyTokens, badPortsSet } = require('./constants')
66
const { getGlobalOrigin } = require('./global')
77
const { collectASequenceOfCodePoints, collectAnHTTPQuotedString, removeChars, parseMIMEType } = require('./data-url')
88
const { performance } = require('node:perf_hooks')
@@ -1286,7 +1286,11 @@ async function readAllBytes (reader, successSteps, failureSteps) {
12861286
function urlIsLocal (url) {
12871287
assert('protocol' in url) // ensure it's a url object
12881288

1289-
return urlLocalScheme.includes(url.protocol)
1289+
const protocol = url.protocol
1290+
1291+
// A URL is local if its scheme is a local scheme.
1292+
// A local scheme is "about", "blob", or "data".
1293+
return protocol === 'about:' || protocol === 'blob:' || protocol === 'data:'
12901294
}
12911295

12921296
/**

0 commit comments

Comments
 (0)