From a628a43b58c7f85e228b148cea5d74a8b24bff70 Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Thu, 6 Oct 2011 20:49:17 +0100 Subject: Revert "Remove SpiderMonkey 1.8.5 compatibility" This reverts commit 5b558c81ed9709fb286a6821e9ae6d6478012c2c. --- share/server/mimeparse.js | 2 +- share/server/util.js | 5 +++++ share/www/script/couch_test_runner.js | 15 ++++++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) (limited to 'share') diff --git a/share/server/mimeparse.js b/share/server/mimeparse.js index 3642a194..42b600fa 100644 --- a/share/server/mimeparse.js +++ b/share/server/mimeparse.js @@ -97,7 +97,7 @@ var Mimeparse = (function() { if ((type == targetType || type == "*" || targetType == "*") && (subtype == targetSubtype || subtype == "*" || targetSubtype == "*")) { var matchCount = 0; - for (param in targetParams) { + for (var param in targetParams) { if (param != 'q' && params[param] && params[param] == targetParams[param]) { matchCount += 1; } diff --git a/share/server/util.js b/share/server/util.js index 0b812fe1..f6fa60bb 100644 --- a/share/server/util.js +++ b/share/server/util.js @@ -63,6 +63,11 @@ var Couch = { }, compileFunction : function(source, ddoc) { if (!source) throw(["error","not_found","missing function"]); + // Some newer SpiderMonkey's appear to not like evaluating + // an anonymous function at global scope. Simple fix just + // wraps the source with parens so the function object is + // returned correctly. + source = "(" + source + ")"; try { if (sandbox) { if (ddoc) { diff --git a/share/www/script/couch_test_runner.js b/share/www/script/couch_test_runner.js index 55a6533f..e14640b6 100644 --- a/share/www/script/couch_test_runner.js +++ b/share/www/script/couch_test_runner.js @@ -414,9 +414,22 @@ function waitForSuccess(fun, tag) { function waitForRestart() { var waiting = true; - while (waiting) { + // Wait for the server to go down but don't + // wait too long because we might miss the + // unavailable period. + var count = 25; + while (waiting && count > 0) { + count--; try { CouchDB.request("GET", "/"); + } catch(e) { + waiting = false; + } + } + // Wait for it to come back up + waiting = true; + while (waiting) { + try { CouchDB.request("GET", "/"); waiting = false; } catch(e) { -- cgit v1.2.3