+ started work on the first run experience: everything goes into a single new group, and there is an info item as well

+ Added "reset" to the dev menu so we can test first run (since the reset button is currently AWOL)
+ Added Utils.assertThrow(), an assert that throws an exception
This commit is contained in:
Ian Gilman 2010-07-07 17:04:01 -07:00
parent 8a017fdd19
commit 990ad5280a

View File

@ -601,6 +601,26 @@ var Utils = {
}
},
// Function: assertThrow
// Throws label as an exception if condition is false.
assertThrow: function(label, condition) {
if(!condition) {
var text;
if(typeof(label) == 'undefined')
text = 'badly formed assert';
else
text = 'tabcandy assert: ' + label;
if(typeof(printStackTrace) == 'function') {
var calls = printStackTrace();
calls.splice(0, 3); // Remove this call and the printStackTrace calls
text += '\n' + calls.join('\n');
}
throw text;
}
},
expandObject: function(obj) {
var s = obj + ' = {';
for(prop in obj) {