From 6728ad4203d731e555dabf89ec6157f113454ce6 Mon Sep 17 00:00:00 2001 From: Kenta Moriuchi Date: Mon, 1 May 2023 22:30:02 +0900 Subject: fix(core): Use primordials for methods (#18839) I would like to get this change into Deno before merging https://github.com/denoland/deno_lint/pull/1152 --- ext/cache/01_cache.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'ext/cache') diff --git a/ext/cache/01_cache.js b/ext/cache/01_cache.js index 8cbf540fa..9b5404acb 100644 --- a/ext/cache/01_cache.js +++ b/ext/cache/01_cache.js @@ -4,9 +4,12 @@ const core = globalThis.Deno.core; import * as webidl from "ext:deno_webidl/00_webidl.js"; const primordials = globalThis.__bootstrap.primordials; const { + ArrayPrototypePush, + ObjectPrototypeIsPrototypeOf, + StringPrototypeSplit, + StringPrototypeTrim, Symbol, TypeError, - ObjectPrototypeIsPrototypeOf, } = primordials; import { Request, @@ -101,10 +104,10 @@ class Cache { // Step 7. const varyHeader = getHeader(innerResponse.headerList, "vary"); if (varyHeader) { - const fieldValues = varyHeader.split(","); + const fieldValues = StringPrototypeSplit(varyHeader, ","); for (let i = 0; i < fieldValues.length; ++i) { const field = fieldValues[i]; - if (field.trim() === "*") { + if (StringPrototypeTrim(field) === "*") { throw new TypeError("Vary header must not contain '*'"); } } @@ -258,7 +261,7 @@ class Cache { statusText: meta.responseStatusText, }, ); - responses.push(response); + ArrayPrototypePush(responses, response); } } // Step 5.4-5.5: don't apply in this context. -- cgit v1.2.3