From 0119e1225620b798f33d7fdb55eabb14de53f66e Mon Sep 17 00:00:00 2001 From: Sylvain Pasche Date: Wed, 16 Sep 2009 02:54:56 +0200 Subject: [PATCH] Bug 514667 - Let Mochitest run on IE r=sayrer --- testing/mochitest/tests/SimpleTest/SimpleTest.js | 6 +++++- testing/mochitest/tests/SimpleTest/TestRunner.js | 10 ++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/testing/mochitest/tests/SimpleTest/SimpleTest.js b/testing/mochitest/tests/SimpleTest/SimpleTest.js index d8aafcea5b97..4f4a59d06a8d 100644 --- a/testing/mochitest/tests/SimpleTest/SimpleTest.js +++ b/testing/mochitest/tests/SimpleTest/SimpleTest.js @@ -8,6 +8,10 @@ * * Support the Test.Simple API used by MochiKit, to be able to test MochiKit * itself against IE 5.5 * + * NOTE: Pay attention to cross-browser compatibility in this file. For + * instance, do not use const or JS > 1.5 features which are not yet + * implemented everywhere. + * **/ if (typeof(SimpleTest) == "undefined") { @@ -549,7 +553,7 @@ var todo_is = SimpleTest.todo_is; var todo_isnot = SimpleTest.todo_isnot; var isDeeply = SimpleTest.isDeeply; -const gOldOnError = window.onerror; +var gOldOnError = window.onerror; window.onerror = function simpletestOnerror(errorMsg, url, lineNumber) { var funcIdentifier = "[SimpleTest/SimpleTest.js, window.onerror] "; diff --git a/testing/mochitest/tests/SimpleTest/TestRunner.js b/testing/mochitest/tests/SimpleTest/TestRunner.js index 7821c8557f7d..7ff99f9c48cd 100644 --- a/testing/mochitest/tests/SimpleTest/TestRunner.js +++ b/testing/mochitest/tests/SimpleTest/TestRunner.js @@ -201,7 +201,9 @@ TestRunner.countResults = function(doc) { } TestRunner.updateUI = function() { - var results = TestRunner.countResults($('testframe').contentDocument); + var testFrame = $('testframe'); + var results = TestRunner.countResults(testFrame.contentDocument || + testFrame.contentWindow.document); var passCount = parseInt($("pass-count").innerHTML) + results.OK; var failCount = parseInt($("fail-count").innerHTML) + results.notOK; var todoCount = parseInt($("todo-count").innerHTML) + results.todo; @@ -227,9 +229,9 @@ TestRunner.updateUI = function() { var row = $(trID); var tds = row.getElementsByTagName("td"); tds[0].style.backgroundColor = "#0d0"; - tds[0].textContent = results.OK; + tds[0].innerHTML = results.OK; tds[1].style.backgroundColor = results.notOK > 0 ? "red" : "#0d0"; - tds[1].textContent = results.notOK; + tds[1].innerHTML = results.notOK; tds[2].style.backgroundColor = results.todo > 0 ? "orange" : "#0d0"; - tds[2].textContent = results.todo; + tds[2].innerHTML = results.todo; }