This commit is contained in:
aza@More-Better-Internet.local 2010-03-16 22:32:05 -07:00
commit eae300dcb7

View File

@ -115,12 +115,12 @@ var Utils = {
consoleService.logStringMessage(text);
},
error: function(text) { // pass as many arguments as you want, it'll print them all
error: function() { // pass as many arguments as you want, it'll print them all
var text = this.expandArgumentsForLog(arguments);
Components.utils.reportError(text);
Cu.reportError('tabcandy error: ' + text);
},
trace: function(text) { // pass as many arguments as you want, it'll print them all
trace: function() { // pass as many arguments as you want, it'll print them all
var text = this.expandArgumentsForLog(arguments);
if(typeof(printStackTrace) != 'function')
this.log(text + ' trace: you need to include stacktrace.js');
@ -131,6 +131,18 @@ var Utils = {
}
},
assert: function(label, condition) {
if(!condition) {
var text = 'tabcandy assert: ' + label;
if(typeof(printStackTrace) == 'function') {
var calls = printStackTrace();
text += '\n' + calls[3];
}
Cu.reportError(text);
}
},
expandObject: function(obj) {
var s = obj + ' = {';
for(prop in obj) {
@ -177,6 +189,12 @@ var Utils = {
return (event.button == 2);
return false;
},
// ___ Time
getMilliseconds: function() {
var date = new Date();
return date.getTime();
}
};