From 672d46fda9bc3b6e87b9ba06727658e375810054 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sat, 7 Aug 2021 08:23:48 -0700 Subject: [PATCH] fixup! url,buffer: implement URL.createObjectURL --- doc/api/buffer.md | 4 +- doc/api/url.md | 9 +- lib/internal/blob.js | 45 ++++---- lib/internal/url.js | 58 +++++----- src/env-inl.h | 19 ---- src/env.cc | 2 - src/env.h | 17 --- src/node_binding.cc | 1 + src/node_blob.cc | 117 ++++++++++++++++++--- src/node_blob.h | 53 +++++++++- src/node_buffer.cc | 5 - src/node_external_reference.h | 1 + src/node_snapshotable.cc | 1 + src/node_snapshotable.h | 3 +- test/parallel/test-blob-createobjecturl.js | 7 +- 15 files changed, 228 insertions(+), 114 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 0a0d0240256c27..f419be1181a61a 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -4959,11 +4959,11 @@ added: REPLACEME > Stability: 1 - Experimental -* `id` {string} A `'blob:node:...` URL string returned by a prior call to +* `id` {string} A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`. * Returns: {Blob} -Resolves a `'blob:node:...'` an associated {Blob} object registered using +Resolves a `'blob:nodedata:...'` an associated {Blob} object registered using a prior call to `URL.createObjectURL()`. ### `buffer.transcode(source, fromEnc, toEnc)` diff --git a/doc/api/url.md b/doc/api/url.md index c9e9f641c4bc14..d4b212f515d4cc 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -618,8 +618,8 @@ added: REPLACEME * `blob` {Blob} * Returns: {string} -Creates a `'blob:node:...'` URL string that represents the given {Blob} object -and can be used to retrieve the `Blob` later. +Creates a `'blob:nodedata:...'` URL string that represents the given {Blob} +object and can be used to retrieve the `Blob` later. ```js const { @@ -641,8 +641,7 @@ The data stored by the registered {Blob} will be retained in memory until `Blob` objects are registered within the current thread. If using Worker Threads, `Blob` objects registered within one Worker will not be available -to other workers or the main thread. The `threadId` of the owning thread -is encoded within the generated object URL. +to other workers or the main thread. #### `URL.revokeObjectURL(id)`