From bf22f114a6e049744866ebaba48faec2cb86549b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 7 Feb 2022 13:54:32 +0100 Subject: refactor: update runtime code for primordial check for iterators (#13510) --- ext/fetch/23_response.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'ext/fetch/23_response.js') diff --git a/ext/fetch/23_response.js b/ext/fetch/23_response.js index 14aadbaf2..4dc56dd8f 100644 --- a/ext/fetch/23_response.js +++ b/ext/fetch/23_response.js @@ -37,6 +37,7 @@ RangeError, RegExp, RegExpPrototypeTest, + SafeArrayIterator, Symbol, SymbolFor, TypeError, @@ -45,7 +46,11 @@ const VCHAR = ["\x21-\x7E"]; const OBS_TEXT = ["\x80-\xFF"]; - const REASON_PHRASE = [...HTTP_TAB_OR_SPACE, ...VCHAR, ...OBS_TEXT]; + const REASON_PHRASE = [ + ...new SafeArrayIterator(HTTP_TAB_OR_SPACE), + ...new SafeArrayIterator(VCHAR), + ...new SafeArrayIterator(OBS_TEXT), + ]; const REASON_PHRASE_MATCHER = regexMatcher(REASON_PHRASE); const REASON_PHRASE_RE = new RegExp(`^[${REASON_PHRASE_MATCHER}]*$`); @@ -90,9 +95,11 @@ * @returns {InnerResponse} */ function cloneInnerResponse(response) { - const urlList = [...response.urlList]; + const urlList = [...new SafeArrayIterator(response.urlList)]; const headerList = [ - ...ArrayPrototypeMap(response.headerList, (x) => [x[0], x[1]]), + ...new SafeArrayIterator( + ArrayPrototypeMap(response.headerList, (x) => [x[0], x[1]]), + ), ]; let body = null; if (response.body !== null) { -- cgit v1.2.3