mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-02 17:08:32 +00:00
Fix: safe serialise TypedArrays to avoid loosing constructor information (#5941)
* fix: enhance cleanJson to support serialization of typed arrays * fix: correctness of inference based checks * fix: remove duplicate Uint8Array reference * fix: correct export syntax for mixinTypedArrays Updated the export statement to use 'exports' instead of 'export' for proper module export functionality. * chore: code cleanup * test: add basics tests for cleanJson
This commit is contained in:
committed by
GitHub
parent
08c182a875
commit
e47d1ed353
@@ -35,6 +35,7 @@ const cheerio = require('cheerio');
|
||||
const tv4 = require('tv4');
|
||||
const jsonwebtoken = require('jsonwebtoken');
|
||||
const { executeQuickJsVmAsync } = require('../sandbox/quickjs');
|
||||
const { mixinTypedArrays } = require('../sandbox/mixins/typed-arrays');
|
||||
|
||||
class ScriptRuntime {
|
||||
constructor(props) {
|
||||
@@ -94,6 +95,10 @@ class ScriptRuntime {
|
||||
__brunoTestResults: __brunoTestResults
|
||||
};
|
||||
|
||||
if (this.runtime === 'vm2') {
|
||||
mixinTypedArrays(context);
|
||||
}
|
||||
|
||||
if (onConsoleLog && typeof onConsoleLog === 'function') {
|
||||
const customLogger = (type) => {
|
||||
return (...args) => {
|
||||
@@ -265,6 +270,10 @@ class ScriptRuntime {
|
||||
__brunoTestResults: __brunoTestResults
|
||||
};
|
||||
|
||||
if (this.runtime === 'vm2') {
|
||||
mixinTypedArrays(context);
|
||||
}
|
||||
|
||||
if (onConsoleLog && typeof onConsoleLog === 'function') {
|
||||
const customLogger = (type) => {
|
||||
return (...args) => {
|
||||
|
||||
Reference in New Issue
Block a user