From: Cheng Zhao Date: Wed, 17 Jul 2013 10:52:02 +0000 (+0800) Subject: Add two tests regarding crashes in context switching. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42a6a7d0d33f87d889cebc8d89aa37393dce6054;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Add two tests regarding crashes in context switching. --- diff --git a/spec/node/contexts.coffee b/spec/node/contexts.coffee new file mode 100644 index 0000000..589b74a --- /dev/null +++ b/spec/node/contexts.coffee @@ -0,0 +1,21 @@ +assert = require 'assert' +fs = require 'fs' + +describe 'contexts', -> + describe 'setTimeout in fs callback', -> + it 'does not crash', (done) -> + fs.readFile __filename, -> + setTimeout done, 0 + + describe 'throw error in node context', -> + it 'get caught', (done) -> + error = new Error('boo!') + lsts = process.listeners 'uncaughtException' + process.removeAllListeners 'uncaughtException' + process.on 'uncaughtException', (err) -> + process.removeAllListeners 'uncaughtException' + for lst in lsts + process.on 'uncaughtException', lst + done() + fs.readFile __filename, -> + throw error