diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js index 40d6c76f..457f80d8 100644 --- a/defaults/preferences/treestyletab.js +++ b/defaults/preferences/treestyletab.js @@ -708,6 +708,8 @@ pref("extensions.treestyletab.prefsVersion", 0); */ pref("extensions.treestyletab.debug.all", false); pref("extensions.treestyletab.debug.autoHide", false); +pref("extensions.treestyletab.debug.base", false); pref("extensions.treestyletab.debug.browser", false); pref("extensions.treestyletab.debug.browserUIShowHideObserver", false); +pref("extensions.treestyletab.debug.contentBridge", false); pref("extensions.treestyletab.debug.tabbarDNDObserver", false); diff --git a/modules/base.js b/modules/base.js index 5cc921cc..9798870e 100644 --- a/modules/base.js +++ b/modules/base.js @@ -149,7 +149,8 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, { this.overrideExtensions(); } catch(e) { - dump(e+'\n'); + if (utils.isDebugging('base')) + dump(e+'\n'); } }, _initialized : false, @@ -518,7 +519,8 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, { var message = 'ERROR: accessed after destruction!'; var error = new Error(message); - dump(message+'\n'+error.stack+'\n'); + if (utils.isDebugging('base')) + dump(message+'\n'+error.stack+'\n'); throw error; }, @@ -949,7 +951,7 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, { { var strip = this.tabStrip; if (!strip) { - if (DEBUG) { + if (utils.isDebugging('base')) { dump('FAILED TO SET TABSTRIP ATTRIBUTE ' + aAttr + '=' + aValue + '\n'); dump((new Error()).stack + '\n'); } @@ -1508,7 +1510,8 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, { refId = aInsertBefore.getAttribute(this.kID); } - dump('Tree Style Tab: new child tab is requested.\n'+new Error().stack+'\n'); + if (utils.isDebugging('base')) + dump('Tree Style Tab: new child tab is requested.\n'+new Error().stack+'\n'); ownerBrowser.treeStyleTab.readiedToAttachNewTab = true; ownerBrowser.treeStyleTab.readiedToAttachMultiple = aMultiple || false ; @@ -1834,7 +1837,8 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, { aTab.label+'\n '+ aTab.getAttribute(this.kID); }, this).join('\n'); - dump(message+'\n'); + if (utils.isDebugging('base')) + dump(message+'\n'); break; } @@ -1846,7 +1850,8 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, { aTab.label+'\n '+ aTab.getAttribute(this.kID); }, this).join('\n'); - dump(message+'\n'); + if (utils.isDebugging('base')) + dump(message+'\n'); } tabs.push(parentTab); @@ -1993,7 +1998,8 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, { aTab.label+'\n '+ aTab.getAttribute(this.kID); }, this).join('\n'); - dump(message+'\n'); + if (utils.isDebugging('base')) + dump(message+'\n'); continue; } tabs.push(tab); diff --git a/modules/browser.js b/modules/browser.js index b9b73fb2..d7287c90 100644 --- a/modules/browser.js +++ b/modules/browser.js @@ -6860,9 +6860,12 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, { Components.utils.reportError(new Error('There is no property named "_browserEpochs"!!')); } - dump('TSTBrowser::restoreTree\n'); - dump(' level = '+level+'\n'); - dump(' tabsToRestore = '+tabsToRestore+'\n'); + if (utils.isDebugging('browser')) { + dump('TSTBrowser::restoreTree\n'); + dump(' level = '+level+'\n'); + dump(' tabsToRestore = '+tabsToRestore+'\n'); + } + if ( level <= this.kRESTORE_TREE_LEVEL_NONE || tabsToRestore <= 1 @@ -6883,7 +6886,10 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, { (!onlyVisible || !aTab.hidden) ); }); - dump(' restoring member tabs = '+tabs.length+' ('+tabs.map(function(aTab) { return aTab._tPos; })+')\n'); + + if (utils.isDebugging('browser')) + dump(' restoring member tabs = '+tabs.length+' ('+tabs.map(function(aTab) { return aTab._tPos; })+')\n'); + if (tabs.length <= 1) return; diff --git a/modules/contentBridge.js b/modules/contentBridge.js index ed1df843..c5ff00e8 100644 --- a/modules/contentBridge.js +++ b/modules/contentBridge.js @@ -102,9 +102,11 @@ ContentBridge.prototype = inherit(TreeStyleTabConstants, { }, handleMessage : function CB_handleMessage(aMessage) { -// dump('*********************handleMessage*******************\n'); -// dump('TARGET IS: '+aMessage.target.localName+'\n'); -// dump(JSON.stringify(aMessage.json)+'\n'); + if (utils.isDebugging('contentBridge')) { + dump('*********************handleMessage*******************\n'); + dump('TARGET IS: '+aMessage.target.localName+'\n'); + dump(JSON.stringify(aMessage.json)+'\n'); + } if (aMessage.target != this.mTab.linkedBrowser) return; diff --git a/modules/tabbarDNDObserver.js b/modules/tabbarDNDObserver.js index c97b82fa..d75807e5 100644 --- a/modules/tabbarDNDObserver.js +++ b/modules/tabbarDNDObserver.js @@ -186,7 +186,8 @@ try{ return info.canDrop; } catch(e) { - dump('TabbarDND::canDrop\n'+e+'\n'); + if (utils.isDebugging('tabbarDNDObserver')) + dump('TabbarDND::canDrop\n'+e+'\n'); return false; } }, @@ -1037,7 +1038,8 @@ try{ return (info.position == sv.kDROP_ON || sv.position != 'top') } catch(e) { - dump('TabbarDND::onDragOver\n'+e+'\n'); + if (utils.isDebugging('tabbarDNDObserver')) + dump('TabbarDND::onDragOver\n'+e+'\n'); } },