[ Web Proxy ]
URL:
Viewing: https://github-redirect.dependabot.com/browserify/browserify/pull/1932 [Back]  [Original]

Polyfill Object.setPrototypeOf in tests on old Node.js versions by goto-bus-stop Pull Request #1932 browserify/browserify GitHub
Skip to content

Navigation Menu

Sign in
Search/
Sign up

Polyfill Object.setPrototypeOf in tests on old Node.js versions - #1932

Closed
goto-bus-stop wants to merge 5 commits into
masterfrom
old-node-tests
Closed

goto-bus-stop wants to merge 5 commits into
masterfrom
old-node-tests

Conversation

@goto-bus-stop [@goto-bus-stop]

Copy link
Copy Markdown
Member

The buffer shim needs setPrototypeOf since feross/buffer#238. buffer's official support targets had it. Node 0.8/0.10 incidentally had the other things it needs, but not this.

[Go]
Comment thread test/buffer.js

if (!ArrayBuffer.isView) ArrayBuffer.isView = function () { return false; };
if (!Object.setPrototypeOf) Object.setPrototypeOf = require('setprototypeof');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Hide comment]

instead of polyfilling it, should it be imported in the implementation? otherwise tests will be assuming the user has polyfilled it, which is not guaranteed.

[Go]

@goto-bus-stop [@goto-bus-stop] goto-bus-stop Nov 13, 2019
edited
Loading

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Hide comment]

I think we can import it in the files that are being bundled for these tests, yes. buffer itself probably wouldn't want to add it because all of the browsers that they support have setPrototypeOf.

e; On second look it's actually a little harder to put the polyfill in the bundle in these specific tests. The buffer tests have to rely on a bunch of polyfills on old Node versions unfortunately. I don't like that we're passing in things like Object to the vm sandbox, the alternative would be to do something like b.require('./test/files/buffer_polyfills.js') and stick the things buffer needs in there.

[Go]

Copy link
Copy Markdown
Member Author

addressed by #1939

[Go]
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

Labels

None yet

Footer

© 2026 GitHub, Inc.

Web Proxy Viewer  |  New URL  |  Original Page