diff --git a/content/base/test/test_bug708620.html b/content/base/test/test_bug708620.html index 7e15e9cf1027..a3f82ffcb015 100644 --- a/content/base/test/test_bug708620.html +++ b/content/base/test/test_bug708620.html @@ -32,11 +32,17 @@ function resolveURL(relative) { return a.href; } +var resolvedURL = resolveURL(tests[0]); + var expectedErrors = [ - '[JavaScript Warning: "A form was submitted in the windows-1252 encoding which cannot encode all Unicode characters, so user input may get corrupted. To avoid this problem, the page should be changed so that the form is submitted in the UTF-8 encoding either by changing the encoding of the page itself to UTF-8 or by specifying accept-charset=utf-8 on the form element." {file: "' + resolveURL(tests[0]) + '" line: 1}]' + '[JavaScript Warning: "A form was submitted in the windows-1252 encoding which cannot encode all Unicode characters, so user input may get corrupted. To avoid this problem, the page should be changed so that the form is submitted in the UTF-8 encoding either by changing the encoding of the page itself to UTF-8 or by specifying accept-charset=utf-8 on the form element." {file: "' + resolvedURL + '" line: 1}]' ]; -function consoleError(msg) { +function consoleError(msg, fileName) { + // Ignore messages not generated by the test + if (fileName !== resolvedURL) { + return; + } var expected = expectedErrors.shift(); is(msg, expected, "Not the right error message"); } diff --git a/testing/mochitest/tests/SimpleTest/specialpowersAPI.js b/testing/mochitest/tests/SimpleTest/specialpowersAPI.js index 63c8ce62ec48..644ebbb24f92 100644 --- a/testing/mochitest/tests/SimpleTest/specialpowersAPI.js +++ b/testing/mochitest/tests/SimpleTest/specialpowersAPI.js @@ -756,7 +756,13 @@ SpecialPowersAPI.prototype = { var consoleListener = { userListener: listener, observe: function(consoleMessage) { - this.userListener(consoleMessage.message); + var fileName; + try { + fileName = consoleMessage.QueryInterface(Ci.nsIScriptError) + .sourceName; + } catch (e) { + } + this.userListener(consoleMessage.message, fileName); } };