summaryrefslogtreecommitdiff
path: root/op_crates/fetch/03_dom_iterable.js
diff options
context:
space:
mode:
authorLuca Casonato <lucacasonato@yahoo.com>2021-04-19 01:00:13 +0200
committerGitHub <noreply@github.com>2021-04-19 01:00:13 +0200
commit0552eaf569ef910b0d132b6e60758f17a4519d91 (patch)
tree6fe6ff3755487475bcef60f3ddb7c8d42432494b /op_crates/fetch/03_dom_iterable.js
parent0c5ecec8f60d4f1586e56b4e6e36ca973c555830 (diff)
chore: align `Headers` to spec (#10199)
This commit aligns `Headers` to spec. It also removes the now unused 03_dom_iterable.js file. We now pass all relevant `Headers` WPT. We do not implement any sort of header filtering, as we are a server side runtime. This is likely not the most efficient implementation of `Headers` yet. It is however spec compliant. Once all the APIs in the `HTTP` hot loop are correct we can start optimizing them. It is likely that this commit reduces bench throughput temporarily.
Diffstat (limited to 'op_crates/fetch/03_dom_iterable.js')
-rw-r--r--op_crates/fetch/03_dom_iterable.js80
1 files changed, 0 insertions, 80 deletions
diff --git a/op_crates/fetch/03_dom_iterable.js b/op_crates/fetch/03_dom_iterable.js
deleted file mode 100644
index 2a3c72fba..000000000
--- a/op_crates/fetch/03_dom_iterable.js
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-"use strict";
-
-((window) => {
- const { requiredArguments } = window.__bootstrap.fetchUtil;
-
- function DomIterableMixin(
- Base,
- dataSymbol,
- ) {
- // we have to cast `this` as `any` because there is no way to describe the
- // Base class in a way where the Symbol `dataSymbol` is defined. So the
- // runtime code works, but we do lose a little bit of type safety.
-
- // Additionally, we have to not use .keys() nor .values() since the internal
- // slot differs in type - some have a Map, which yields [K, V] in
- // Symbol.iterator, and some have an Array, which yields V, in this case
- // [K, V] too as they are arrays of tuples.
-
- const DomIterable = class extends Base {
- *entries() {
- for (const entry of this[dataSymbol]) {
- yield entry;
- }
- }
-
- *keys() {
- for (const [key] of this[dataSymbol]) {
- yield key;
- }
- }
-
- *values() {
- for (const [, value] of this[dataSymbol]) {
- yield value;
- }
- }
-
- forEach(
- callbackfn,
- thisArg,
- ) {
- requiredArguments(
- `${this.constructor.name}.forEach`,
- arguments.length,
- 1,
- );
- callbackfn = callbackfn.bind(
- thisArg == null ? globalThis : Object(thisArg),
- );
- for (const [key, value] of this[dataSymbol]) {
- callbackfn(value, key, this);
- }
- }
-
- *[Symbol.iterator]() {
- for (const entry of this[dataSymbol]) {
- yield entry;
- }
- }
- };
-
- // we want the Base class name to be the name of the class.
- Object.defineProperty(DomIterable, "name", {
- value: Base.name,
- configurable: true,
- });
-
- return DomIterable;
- }
-
- window.__bootstrap.internals = {
- ...window.__bootstrap.internals ?? {},
- DomIterableMixin,
- };
-
- window.__bootstrap.domIterable = {
- DomIterableMixin,
- };
-})(this);