buffer: add @@toStringTag to Blob - #37336
Merged
Merged
Conversation
5 tasks
lpinca
approved these changes
Feb 13, 2021
marsonya
approved these changes
Feb 13, 2021
Contributor
|
EDIT: nevermind, that's just how JavaScript works 😅 $ out/Release/node -p '(new require("buffer").Blob)[Symbol.toStringTag]'
undefined
$ out/Release/node -p '(new buffer.Blob)[Symbol.toStringTag]'
Blob
(node:41638) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
$ out/Release/node -p 'new (require("buffer").Blob)()[Symbol.toStringTag]'
Blob
(node:41638) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
$ out/Release/node -p 'Object.prototype.toString.call(new buffer.Blob)'
[object Blob]
(node:41683) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)On a chromium browser I get: > (new globalThis.Blob)[Symbol.toStringTag]
"Blob"
> new (globalThis.Blob)()[Symbol.toStringTag]
"Blob"
> Object.prototype.toString.call(new globalThis.Blob)
"[object Blob]" |
aduh95
approved these changes
Feb 13, 2021
Collaborator
Collaborator
jasnell
approved these changes
Feb 14, 2021
This commit adds the toStringTag to the Blob class to match the behavior of Chrome and Firefox. PR-URL: nodejs#37336 Fixes: nodejs#37337 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit adds the
toStringTagto theBlobclass to match the behavior of Chrome and Firefox.Fixes: #37337