From c00820c12863cdfdbbf4c6c7eb36709aceba74b1 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sun, 22 Jan 2012 19:17:39 -0500 Subject: [PATCH] Fix IE 8 compatibility --- .../zotero/tools/testTranslators/translatorTester.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/chrome/content/zotero/tools/testTranslators/translatorTester.js b/chrome/content/zotero/tools/testTranslators/translatorTester.js index 1c979dd65a..5bb871fbdb 100644 --- a/chrome/content/zotero/tools/testTranslators/translatorTester.js +++ b/chrome/content/zotero/tools/testTranslators/translatorTester.js @@ -54,12 +54,9 @@ Zotero_TranslatorTester = function(translator, type, debug) { var testStart = code.indexOf("/** BEGIN TEST CASES **/"); var testEnd = code.indexOf("/** END TEST CASES **/"); if (testStart !== -1 && testEnd !== -1) { - var test = code.substring(testStart + 24, testEnd); - test = test.replace(/var testCases = /,'').trim(); - // The JSON parser doesn't like final semicolons - if (test.lastIndexOf(';') == (test.length-1)) { - test = test.slice(0,-1); - } + var test = code.substring(testStart + 24, testEnd) + .replace(/^[\s\r\n]*var testCases = /, '') + .replace(/;[\s\r\n]*$/, ''); try { var testObject = JSON.parse(test); } catch (e) {