From 0b0843e4a54d7c1ddf293ac1ccee2479b69a5ba9 Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Wed, 17 Aug 2022 16:29:26 +0200 Subject: refactor(fetch/request): use callback for url and method (#15483) --- ext/fetch/26_fetch.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'ext/fetch/26_fetch.js') diff --git a/ext/fetch/26_fetch.js b/ext/fetch/26_fetch.js index a069583a7..c980bc9b8 100644 --- a/ext/fetch/26_fetch.js +++ b/ext/fetch/26_fetch.js @@ -28,6 +28,7 @@ nullBodyStatus, networkError, abortedNetworkError, + processUrlList, } = window.__bootstrap.fetch; const abortSignal = window.__bootstrap.abortSignal; const { @@ -295,6 +296,8 @@ } if (terminator.aborted) return abortedNetworkError(); + processUrlList(req.urlList, req.urlListProcessed); + /** @type {InnerResponse} */ const response = { headerList: resp.headers, @@ -306,7 +309,7 @@ if (this.urlList.length == 0) return null; return this.urlList[this.urlList.length - 1]; }, - urlList: req.urlList, + urlList: req.urlListProcessed, }; if (redirectStatus(resp.status)) { switch (req.redirectMode) { @@ -339,7 +342,8 @@ if (recursive) return response; if (response.urlList.length === 0) { - response.urlList = [...new SafeArrayIterator(req.urlList)]; + processUrlList(req.urlList, req.urlListProcessed); + response.urlList = [...new SafeArrayIterator(req.urlListProcessed)]; } return response; @@ -407,7 +411,7 @@ const res = extractBody(request.body.source); request.body = res.body; } - ArrayPrototypePush(request.urlList, locationURL.href); + ArrayPrototypePush(request.urlList, () => locationURL.href); return mainFetch(request, true, terminator); } -- cgit v1.2.3