From 073ac859c8d92382662b7075813edf1f3fa98f9b Mon Sep 17 00:00:00 2001 From: Carlos Fuentes Date: Wed, 23 Mar 2022 23:06:38 +0100 Subject: [PATCH] feat: smaller improvements --- lib/fetch/util.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/fetch/util.js b/lib/fetch/util.js index 0e93fe468f9..fe53a441281 100644 --- a/lib/fetch/util.js +++ b/lib/fetch/util.js @@ -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 @@ -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' }