Skip to content

buffer: add @@toStringTag to Blob - #37336

Merged
cjihrig merged 1 commit into
nodejs:masterfrom
cjihrig:blob
Feb 15, 2021
Merged

buffer: add @@toStringTag to Blob#37336
cjihrig merged 1 commit into
nodejs:masterfrom
cjihrig:blob

Conversation

@cjihrig

@cjihrig cjihrig commented Feb 12, 2021

Copy link
Copy Markdown
Contributor

This commit adds the toStringTag to the Blob class to match the behavior of Chrome and Firefox.

Fixes: #37337

@aduh95

aduh95 commented Feb 13, 2021

Copy link
Copy Markdown
Contributor

It doesn't seem to fix #37337 for all the cases:

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 aduh95 added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Feb 13, 2021
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

nodejs-github-bot commented Feb 14, 2021

Copy link
Copy Markdown
Collaborator

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Symbol.toStringTag is missing in buffer.Blob

7 participants