11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciconst bufferWarning = 'Buffer() is deprecated due to security and usability ' + 61cb0ef41Sopenharmony_ci 'issues. Please use the Buffer.alloc(), ' + 71cb0ef41Sopenharmony_ci 'Buffer.allocUnsafe(), or Buffer.from() methods instead.'; 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_cicommon.expectWarning('DeprecationWarning', bufferWarning, 'DEP0005'); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci// This is used to make sure that a warning is only emitted once even though 121cb0ef41Sopenharmony_ci// `new Buffer()` is called twice. 131cb0ef41Sopenharmony_ciprocess.on('warning', common.mustCall()); 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ciError.prepareStackTrace = (err, trace) => new Buffer(10); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_cinew Error().stack; // eslint-disable-line no-unused-expressions 18