diff options
Diffstat (limited to 'js/baba-yaga/debug-sandbox.js')
-rw-r--r-- | js/baba-yaga/debug-sandbox.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/js/baba-yaga/debug-sandbox.js b/js/baba-yaga/debug-sandbox.js new file mode 100644 index 0000000..96b66be --- /dev/null +++ b/js/baba-yaga/debug-sandbox.js @@ -0,0 +1,27 @@ +// debug-sandbox.js - Debug the sandbox structure + +import { createDefaultJSBridge } from './src/core/js-bridge.js'; + +const bridge = createDefaultJSBridge({ + allowedFunctions: new Set([ + 'JSON.parse', 'JSON.stringify', + 'Math.abs', 'Math.floor', 'Math.ceil', 'Math.round', + 'Math.min', 'Math.max', 'Math.random', + 'console.log', 'console.warn', 'console.error', + 'Date.now', 'performance.now' + ]) +}); + +console.log('Sandbox keys:', Object.keys(bridge.config.sandbox)); +console.log('Math object:', bridge.config.sandbox.Math); +console.log('Math.abs:', bridge.config.sandbox.Math.abs); +console.log('typeof Math.abs:', typeof bridge.config.sandbox.Math.abs); + +// Test function resolution +const fn = bridge.resolveFunction('Math.abs'); +console.log('Resolved function:', fn); +console.log('Function type:', typeof fn); + +// Test function call +const result = bridge.callFunction('Math.abs', [-5]); +console.log('Call result:', result); |