Skip to content

Commit

Permalink
feat: smaller improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
metcoder95 committed Mar 23, 2022
1 parent b8c9cb4 commit 073ac85
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/fetch/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ function determineRequestsReferrer (request) {
const policy = request.referrerPolicy

// Return no-referrer when empty or policy says so
if (policy === '' || policy === 'no-referrer') return 'no-referrer'
if (policy == null || policy === '' || policy === 'no-referrer') {
return 'no-referrer'
}

// 2. Let environment be the request client
const environment = request.client
Expand Down Expand Up @@ -326,7 +328,10 @@ function determineRequestsReferrer (request) {

// If url's scheme is a local scheme (i.e. one of "about", "data", "javascript", "file")
// then return "no-referrer".
if (urlProtocol === 'about:' || urlProtocol === 'data:' || urlProtocol === 'data:') {
if (
urlProtocol === 'about:' || urlProtocol === 'data:' ||
urlProtocol === 'javascript:' || urlProtocol === 'file:'
) {
return 'no-referrer'
}

Expand Down

0 comments on commit 073ac85

Please sign in to comment.