Bug 1117566 - Fix some JavaScript warnings in SimpleTest runner. r=jmaher

This commit is contained in:
Chris Peterson 2014-12-21 22:03:37 -08:00
Родитель f435e22a55
Коммит c8da89cfae
2 изменённых файлов: 11 добавлений и 5 удалений

Просмотреть файл

@ -5,6 +5,9 @@
* type = eventName (QuitApplication)
* data = json object {"filename":filename} <- for LoggerInit
*/
"use strict";
function getElement(id) {
return ((typeof(id) == "string") ?
document.getElementById(id) : id);
@ -264,6 +267,7 @@ function StructuredLogger(name) {
} else {
str = LOG_DELIMITER + JSON.stringify(message) + LOG_DELIMITER;
}
// BUGFIX: browser-chrome tests doesn't use LogController
if (Object.keys(LogController.listeners).length !== 0) {
LogController.log(str);
@ -272,7 +276,7 @@ function StructuredLogger(name) {
}
// Checking for error messages
if (message.expected || message.level === "ERROR") {
if (message.expected || (message.level && message.level === "ERROR")) {
TestRunner.failureHandler();
}
};
@ -281,7 +285,6 @@ function StructuredLogger(name) {
this.validMessage = function(message) {
return message.action !== undefined && VALID_ACTIONS.indexOf(message.action) >= 0;
};
}
/**

Просмотреть файл

@ -4,14 +4,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
TestRunner.logEnabled = true;
TestRunner.logger = LogController;
/* Helper function */
parseQueryString = function(encodedString, useArrays) {
function parseQueryString(encodedString, useArrays) {
// strip a leading '?' from the encoded string
var qstr = (encodedString[0] == "?") ? encodedString.substring(1) :
encodedString;
var qstr = (encodedString.length > 0 && encodedString[0] == "?")
? encodedString.substring(1)
: encodedString;
var pairs = qstr.replace(/\+/g, "%20").split(/(\&amp\;|\&\#38\;|\&#x26;|\&)/);
var o = {};
var decode;