Skip to content

Commit

Permalink
fix(core): Use primordials for methods (denoland#18839)
Browse files Browse the repository at this point in the history
I would like to get this change into Deno before merging
denoland/deno_lint#1152
  • Loading branch information
petamoriken authored May 1, 2023
1 parent 94a148c commit 6728ad4
Show file tree
Hide file tree
Showing 17 changed files with 374 additions and 266 deletions.
2 changes: 1 addition & 1 deletion core/01_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
SafeArrayIterator,
SafeMap,
SafePromisePrototypeFinally,
setQueueMicrotask,
StringPrototypeSlice,
StringPrototypeSplit,
SymbolFor,
SyntaxError,
TypeError,
URIError,
setQueueMicrotask,
} = window.__bootstrap.primordials;
const { ops, asyncOps } = window.Deno.core;

Expand Down
11 changes: 7 additions & 4 deletions ext/cache/01_cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 '*'");
}
}
Expand Down Expand Up @@ -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.
Expand Down
Loading

0 comments on commit 6728ad4

Please sign in to comment.