Control more debug prints by preferences

This commit is contained in:
YUKI Hiroshi 2015-10-26 16:37:28 +09:00
parent de777e7ff2
commit 5bd7112a24
5 changed files with 34 additions and 16 deletions

View File

@ -708,6 +708,8 @@ pref("extensions.treestyletab.prefsVersion", 0);
*/ */
pref("extensions.treestyletab.debug.all", false); pref("extensions.treestyletab.debug.all", false);
pref("extensions.treestyletab.debug.autoHide", false); pref("extensions.treestyletab.debug.autoHide", false);
pref("extensions.treestyletab.debug.base", false);
pref("extensions.treestyletab.debug.browser", false); pref("extensions.treestyletab.debug.browser", false);
pref("extensions.treestyletab.debug.browserUIShowHideObserver", false); pref("extensions.treestyletab.debug.browserUIShowHideObserver", false);
pref("extensions.treestyletab.debug.contentBridge", false);
pref("extensions.treestyletab.debug.tabbarDNDObserver", false); pref("extensions.treestyletab.debug.tabbarDNDObserver", false);

View File

@ -149,7 +149,8 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
this.overrideExtensions(); this.overrideExtensions();
} }
catch(e) { catch(e) {
dump(e+'\n'); if (utils.isDebugging('base'))
dump(e+'\n');
} }
}, },
_initialized : false, _initialized : false,
@ -518,7 +519,8 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
var message = 'ERROR: accessed after destruction!'; var message = 'ERROR: accessed after destruction!';
var error = new Error(message); var error = new Error(message);
dump(message+'\n'+error.stack+'\n'); if (utils.isDebugging('base'))
dump(message+'\n'+error.stack+'\n');
throw error; throw error;
}, },
@ -949,7 +951,7 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
{ {
var strip = this.tabStrip; var strip = this.tabStrip;
if (!strip) { if (!strip) {
if (DEBUG) { if (utils.isDebugging('base')) {
dump('FAILED TO SET TABSTRIP ATTRIBUTE ' + aAttr + '=' + aValue + '\n'); dump('FAILED TO SET TABSTRIP ATTRIBUTE ' + aAttr + '=' + aValue + '\n');
dump((new Error()).stack + '\n'); dump((new Error()).stack + '\n');
} }
@ -1508,7 +1510,8 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
refId = aInsertBefore.getAttribute(this.kID); 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.readiedToAttachNewTab = true;
ownerBrowser.treeStyleTab.readiedToAttachMultiple = aMultiple || false ; ownerBrowser.treeStyleTab.readiedToAttachMultiple = aMultiple || false ;
@ -1834,7 +1837,8 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
aTab.label+'\n '+ aTab.label+'\n '+
aTab.getAttribute(this.kID); aTab.getAttribute(this.kID);
}, this).join('\n'); }, this).join('\n');
dump(message+'\n'); if (utils.isDebugging('base'))
dump(message+'\n');
break; break;
} }
@ -1846,7 +1850,8 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
aTab.label+'\n '+ aTab.label+'\n '+
aTab.getAttribute(this.kID); aTab.getAttribute(this.kID);
}, this).join('\n'); }, this).join('\n');
dump(message+'\n'); if (utils.isDebugging('base'))
dump(message+'\n');
} }
tabs.push(parentTab); tabs.push(parentTab);
@ -1993,7 +1998,8 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
aTab.label+'\n '+ aTab.label+'\n '+
aTab.getAttribute(this.kID); aTab.getAttribute(this.kID);
}, this).join('\n'); }, this).join('\n');
dump(message+'\n'); if (utils.isDebugging('base'))
dump(message+'\n');
continue; continue;
} }
tabs.push(tab); tabs.push(tab);

View File

@ -6860,9 +6860,12 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
Components.utils.reportError(new Error('There is no property named "_browserEpochs"!!')); Components.utils.reportError(new Error('There is no property named "_browserEpochs"!!'));
} }
dump('TSTBrowser::restoreTree\n'); if (utils.isDebugging('browser')) {
dump(' level = '+level+'\n'); dump('TSTBrowser::restoreTree\n');
dump(' tabsToRestore = '+tabsToRestore+'\n'); dump(' level = '+level+'\n');
dump(' tabsToRestore = '+tabsToRestore+'\n');
}
if ( if (
level <= this.kRESTORE_TREE_LEVEL_NONE || level <= this.kRESTORE_TREE_LEVEL_NONE ||
tabsToRestore <= 1 tabsToRestore <= 1
@ -6883,7 +6886,10 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
(!onlyVisible || !aTab.hidden) (!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) if (tabs.length <= 1)
return; return;

View File

@ -102,9 +102,11 @@ ContentBridge.prototype = inherit(TreeStyleTabConstants, {
}, },
handleMessage : function CB_handleMessage(aMessage) handleMessage : function CB_handleMessage(aMessage)
{ {
// dump('*********************handleMessage*******************\n'); if (utils.isDebugging('contentBridge')) {
// dump('TARGET IS: '+aMessage.target.localName+'\n'); dump('*********************handleMessage*******************\n');
// dump(JSON.stringify(aMessage.json)+'\n'); dump('TARGET IS: '+aMessage.target.localName+'\n');
dump(JSON.stringify(aMessage.json)+'\n');
}
if (aMessage.target != this.mTab.linkedBrowser) if (aMessage.target != this.mTab.linkedBrowser)
return; return;

View File

@ -186,7 +186,8 @@ try{
return info.canDrop; return info.canDrop;
} }
catch(e) { catch(e) {
dump('TabbarDND::canDrop\n'+e+'\n'); if (utils.isDebugging('tabbarDNDObserver'))
dump('TabbarDND::canDrop\n'+e+'\n');
return false; return false;
} }
}, },
@ -1037,7 +1038,8 @@ try{
return (info.position == sv.kDROP_ON || sv.position != 'top') return (info.position == sv.kDROP_ON || sv.position != 'top')
} }
catch(e) { catch(e) {
dump('TabbarDND::onDragOver\n'+e+'\n'); if (utils.isDebugging('tabbarDNDObserver'))
dump('TabbarDND::onDragOver\n'+e+'\n');
} }
}, },