Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding process.nextTick to the sandbox

  • Loading branch information...
commit b5e57768850df20811d7d5822085ec8d12bc2074 1 parent 0541b7d
@tjanczuk authored
View
6 samples/haikus/tests/entrypoint_nextTick.js
@@ -0,0 +1,6 @@
+res.writeHead(200)
+var result = [haiku.getCurrentContextData()]
+process.nextTick(function () {
+ result.push(haiku.getCurrentContextData())
+ res.end(JSON.stringify(result))
+})
View
3  src/sandbox.js
@@ -304,6 +304,9 @@ function createSandbox(context, addons) {
haiku: {
getContextDataOf: passthroughFunctionWrap(haiku_extensions.getContextDataOf),
getCurrentContextData: passthroughFunctionWrap(haiku_extensions.getCurrentContextData)
+ },
+ process: {
+ nextTick: passthroughFunctionWrap(process.nextTick)
}
};
View
12 test/400_entrypoint.js
@@ -26,6 +26,18 @@ describe('400_entrypoint.js:', function () {
})
})
+ it('http://localhost?x-haiku-handler=http://localhost:8000/tests/entrypoint_nextTick is sandboxed', function (done) {
+ request('http://localhost?x-haiku-handler=http://localhost:8000/tests/entrypoint_nextTick', function (err, res, body) {
+ assert.ifError(err)
+ assert.equal(res.statusCode, 200)
+ var result = JSON.parse(body)
+ assert.equal(result[0], result[1])
+ assert.ok(0 < result[0].indexOf('#'))
+ assert.equal(result[0].substring(result[0].indexOf('#') + 1), 'http://localhost:8000/tests/entrypoint_nextTick')
+ done()
+ })
+ })
+
it('http://localhost?x-haiku-handler=http://localhost:8000/tests/entrypoint_EventEmitter is sandboxed (using MongoDB)', function (done) {
request('http://localhost?x-haiku-handler=http://localhost:8000/tests/entrypoint_EventEmitter', function (err, res, body) {
assert.ifError(err)
Please sign in to comment.
Something went wrong with that request. Please try again.