PR-URL: https://github.com/nodejs/node/pull/62389 Backport-PR-URL: https://github.com/nodejs/node/pull/63563 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
26 lines
533 B
JavaScript
26 lines
533 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const { WPTRunner } = require('../common/wpt');
|
|
|
|
const runner = new WPTRunner('WebCryptoAPI');
|
|
|
|
runner.setInitScript(`
|
|
if (Uint8Array.fromHex === undefined) {
|
|
Object.defineProperty(Uint8Array, 'fromHex', {
|
|
__proto__: null,
|
|
configurable: true,
|
|
writable: true,
|
|
value(hex) {
|
|
return new Uint8Array(Buffer.from(hex, 'hex'));
|
|
},
|
|
});
|
|
}
|
|
`);
|
|
|
|
runner.pretendGlobalThisAs('Window');
|
|
|
|
runner.runJsTests();
|