Skip to content

Commit d46446a

Browse files
ryzokukentargos
authored andcommitted
v8: replace Buffer with FastBuffer in deserialize
Replace the Buffer constructor with a FastBuffer in v8.deserialize in order to avoid calling the Buffer constructor and thus triggering a deprecation warning from code inside the core. Fixes: #21181 PR-URL: #21196 Fixes: #21181 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 13fd09b commit d46446a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/v8.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const arrayBufferViewTypeToIndex = new Map();
143143
}
144144
}
145145

146-
const bufferConstructorIndex = arrayBufferViewTypes.push(Buffer) - 1;
146+
const bufferConstructorIndex = arrayBufferViewTypes.push(FastBuffer) - 1;
147147

148148
class DefaultSerializer extends Serializer {
149149
constructor() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Flags: --pending-deprecation --no-warnings
2+
'use strict';
3+
4+
const common = require('../common');
5+
const v8 = require('v8');
6+
7+
process.on('warning', common.mustNotCall());
8+
v8.deserialize(v8.serialize(Buffer.alloc(0)));

0 commit comments

Comments
 (0)