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

perf(fetch): Improve fetch of detaurl #2479

Merged
merged 20 commits into from
Dec 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
suggestion change
  • Loading branch information
tsctx committed Nov 30, 2023
commit 99a9f09ba044bfb16c8181e0e043a9f54eda420d
10 changes: 5 additions & 5 deletions lib/fetch/dataURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function dataURLProcessor (dataURL) {
let input = URLSerializer(dataURL, true)

// 3. Remove the leading "data:" string from input.
input = input.substring(5)
input = input.slice(5)

// 4. Let position point at the start of input.
const position = { position: 0 }
Expand Down Expand Up @@ -59,7 +59,7 @@ function dataURLProcessor (dataURL) {
position.position++

// 9. Let encodedBody be the remainder of input.
const encodedBody = input.substring(mimeTypeLength + 1)
const encodedBody = input.slice(mimeTypeLength + 1)

// 10. Let body be the percent-decoding of encodedBody.
let body = stringPercentDecode(encodedBody)
Expand Down Expand Up @@ -165,11 +165,11 @@ function collectASequenceOfCodePointsFast (char, input, position) {

if (idx === -1) {
position.position = input.length
return input.substring(start)
return input.slice(start)
}

position.position = idx
return input.substring(start, position.position)
return input.slice(start, position.position)
}

// https://url.spec.whatwg.org/#string-percent-decode
Expand Down Expand Up @@ -515,7 +515,7 @@ function collectAnHTTPQuotedString (input, position, extractValue) {

// 7. Return the code points from positionStart to position,
// inclusive, within input.
return input.substring(positionStart, position.position)
return input.slice(positionStart, position.position)
}

/**
Expand Down
Loading