From 9c0888d54d6c45f2f778973c06fda2c07493a77b Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Sun, 16 Dec 2012 23:01:25 -0800 Subject: [PATCH] Fix potential hang in the example scripts due to missing exit() call. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Jônatas Pedraza and Vivek Galatage . http://code.google.com/p/phantomjs/issues/detail?id=922 --- examples/detectsniff.coffee | 1 + examples/detectsniff.js | 1 + examples/rasterize.js | 1 + 3 files changed, 3 insertions(+) diff --git a/examples/detectsniff.coffee b/examples/detectsniff.coffee index 9661230e..b8d27198 100644 --- a/examples/detectsniff.coffee +++ b/examples/detectsniff.coffee @@ -28,6 +28,7 @@ else page.open address, (status) -> if status isnt 'success' console.log 'FAIL to load the address' + phantom.exit() else window.setTimeout -> sniffed = page.evaluate(-> diff --git a/examples/detectsniff.js b/examples/detectsniff.js index d636b81b..e23c4103 100644 --- a/examples/detectsniff.js +++ b/examples/detectsniff.js @@ -41,6 +41,7 @@ if (system.args.length === 1) { page.open(address, function (status) { if (status !== 'success') { console.log('FAIL to load the address'); + phantom.exit(); } else { window.setTimeout(function () { sniffed = page.evaluate(function () { diff --git a/examples/rasterize.js b/examples/rasterize.js index 514126e1..165bcfa7 100644 --- a/examples/rasterize.js +++ b/examples/rasterize.js @@ -21,6 +21,7 @@ if (system.args.length < 3 || system.args.length > 5) { page.open(address, function (status) { if (status !== 'success') { console.log('Unable to load the address!'); + phantom.exit(); } else { window.setTimeout(function () { page.render(output);