isolated-vm
Advanced tools
Comparing version 1.3.1 to 1.4.0
{ | ||
"name": "isolated-vm", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"description": "Access to multiple isolates", | ||
@@ -5,0 +5,0 @@ "main": "isolated-vm.js", |
@@ -141,2 +141,11 @@ [](https://www.npmjs.com/package/isolated-vm) [](https://github.com/laverdet/isolated-vm/blob/master/LICENSE) [](https://travis-ci.org/laverdet/isolated-vm) | ||
##### `isolate.referenceCount` *[number]* | ||
Returns the total count of active `Reference` instances that belong to this isolate. Note that in | ||
certain cases many `Reference` instances in JavaScript will point to the same underlying reference | ||
handle, in which case this number will only reflect the underlying reference handle. This happens | ||
when you transfer a `Reference` instance via some method which accepts transferable values. This | ||
will also include underlying reference handles created by isolated-vm like `Script` or `Context` | ||
objects. | ||
### Class: `Context` *[transferable]* | ||
@@ -143,0 +152,0 @@ A context is a sandboxed execution environment within an isolate. Each context contains its own |
@@ -29,3 +29,3 @@ 'use strict'; | ||
let i2 = err.stack.indexOf('env2'); | ||
let i3 = err.stack.indexOf('Module'); | ||
let i3 = err.stack.indexOf('exception-info.js'); | ||
if (sync === true) { | ||
@@ -68,1 +68,25 @@ if (i0 == -1 || i1 == -1 || i2 == -1 || i3 == -1 || i0 > i1 || i1 > i2 || i2 > i3) { | ||
}); | ||
// Try async recursive | ||
{ | ||
let isolate = new ivm.Isolate({ memoryLimit: 16}); | ||
let context = isolate.createContextSync(); | ||
context.global.setSync('context', context); | ||
context.global.setSync('isolate', isolate); | ||
isolate.compileScriptSync('new '+function() { | ||
let script = isolate.compileScriptSync(` | ||
function infinite() { | ||
for(;;); | ||
} | ||
infinite(); | ||
`); | ||
script.runSync(context, { timeout: 10 }); | ||
return 'arst'; | ||
}).run(context).then(_ => console.log('recursive did not throw')).catch(function(err) { | ||
if (!/infinite/.test(err.stack)) { | ||
console.log('no recursive stack'); | ||
} | ||
}); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
317428
1597
476