Skip to content

Commit

Permalink
buffer: remove unnecessary lazy loading
Browse files Browse the repository at this point in the history
PR-URL: #45807
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
  • Loading branch information
aduh95 authored and targos committed Dec 13, 2022
1 parent 349b4f8 commit 49840d4
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/internal/blob.js
Expand Up @@ -30,6 +30,7 @@ const {
TextDecoder,
TextEncoder,
} = require('internal/encoding');
const { URL } = require('internal/url');

const {
makeTransferable,
Expand Down Expand Up @@ -77,7 +78,6 @@ const kMaxChunkSize = 65536;
const disallowedTypeCharacters = /[^\u{0020}-\u{007E}]/u;

let ReadableStream;
let URL;

const enc = new TextEncoder();
let dec;
Expand All @@ -86,11 +86,6 @@ let dec;
// references between the url, internal/blob, and buffer
// modules, lazy loading here makes sure that things work.

function lazyURL(id) {
URL ??= require('internal/url').URL;
return new URL(id);
}

function lazyReadableStream(options) {
// eslint-disable-next-line no-global-assign
ReadableStream ??=
Expand Down Expand Up @@ -378,7 +373,7 @@ ObjectDefineProperties(Blob.prototype, {
function resolveObjectURL(url) {
url = `${url}`;
try {
const parsed = new lazyURL(url);
const parsed = new URL(url);

const split = StringPrototypeSplit(parsed.pathname, ':');

Expand Down

0 comments on commit 49840d4

Please sign in to comment.