Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update spec & wpts #2482

Merged
merged 7 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/core/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ async function * convertIterableToBuffer (iterable) {
}
}

/** @type {globalThis['ReadableStream']} */
let ReadableStream
function ReadableStreamFrom (iterable) {
if (!ReadableStream) {
Expand Down Expand Up @@ -395,9 +396,9 @@ function ReadableStreamFrom (iterable) {
},
async cancel (reason) {
await iterator.return()
}
},
0
},
type: 'bytes'
}
)
}

Expand Down
6 changes: 3 additions & 3 deletions lib/fetch/body.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function extractBody (object, keepalive = false) {
stream = object.stream()
} else {
// 4. Otherwise, set stream to a new ReadableStream object, and set
// up stream.
// up stream with byte reading support.
stream = new ReadableStream({
async pull (controller) {
controller.enqueue(
Expand All @@ -56,7 +56,7 @@ function extractBody (object, keepalive = false) {
queueMicrotask(() => readableStreamClose(controller))
},
start () {},
type: undefined
type: 'bytes'
})
}

Expand Down Expand Up @@ -237,7 +237,7 @@ function extractBody (object, keepalive = false) {
async cancel (reason) {
await iterator.return()
},
type: undefined
type: 'bytes'
})
}

Expand Down
8 changes: 7 additions & 1 deletion lib/fetch/dataURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,13 @@ function URLSerializer (url, excludeFragment = false) {
const href = url.href
const hashLength = url.hash.length

return hashLength === 0 ? href : href.substring(0, href.length - hashLength)
const serialized = hashLength === 0 ? href : href.substring(0, href.length - hashLength)
KhafraDev marked this conversation as resolved.
Show resolved Hide resolved

if (!hashLength && href.endsWith('#')) {
return serialized.slice(0, -1)
}

return serialized
}

// https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points
Expand Down