From 990ad5280ac2086b01fb0185c5d1becb672f79b8 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Wed, 7 Jul 2010 17:04:01 -0700 Subject: [PATCH] + 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 --- .../base/content/tabview/modules/utils.jsm | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/browser/base/content/tabview/modules/utils.jsm b/browser/base/content/tabview/modules/utils.jsm index 7a40d28d1ac..6d9e8e9ce92 100644 --- a/browser/base/content/tabview/modules/utils.jsm +++ b/browser/base/content/tabview/modules/utils.jsm @@ -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) {