handle errors in deferred tasks
This commit is contained in:
parent
4229ff6ec4
commit
c844906cb1
@ -247,7 +247,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
this.Deferred.next(function() {
|
this.Deferred.next(function() {
|
||||||
self.checkTabsIndentOverflow();
|
self.checkTabsIndentOverflow();
|
||||||
self.fireTabbarPositionEvent(false, oldPosition, aNewPosition);
|
self.fireTabbarPositionEvent(false, oldPosition, aNewPosition);
|
||||||
});
|
}).error(this.defaultDeferredErrorHandler);
|
||||||
},
|
},
|
||||||
|
|
||||||
/* status getters */
|
/* status getters */
|
||||||
@ -480,7 +480,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
if (aJustNow)
|
if (aJustNow)
|
||||||
this.Deferred.next(function() { // "transition" must be cleared after the reflow.
|
this.Deferred.next(function() { // "transition" must be cleared after the reflow.
|
||||||
style.MozTransition = style.transition = transitionStyleBackup;
|
style.MozTransition = style.transition = transitionStyleBackup;
|
||||||
});
|
}).error(this.defaultDeferredErrorHandler);
|
||||||
|
|
||||||
col++;
|
col++;
|
||||||
if (col >= maxCol) {
|
if (col >= maxCol) {
|
||||||
@ -505,7 +505,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
aSelf.Deferred.next(function() {
|
aSelf.Deferred.next(function() {
|
||||||
// do with delay again, after Firefox's reposition was completely finished.
|
// do with delay again, after Firefox's reposition was completely finished.
|
||||||
aSelf.positionPinnedTabs.apply(aSelf, aSelf._positionPinnedTabsWithDelayTimerArgs);
|
aSelf.positionPinnedTabs.apply(aSelf, aSelf._positionPinnedTabsWithDelayTimerArgs);
|
||||||
});
|
}).error(aSelf.defaultDeferredErrorHandler);
|
||||||
aSelf._positionPinnedTabsWithDelayTimer = null;
|
aSelf._positionPinnedTabsWithDelayTimer = null;
|
||||||
aSelf._positionPinnedTabsWithDelayTimerArgs = null;
|
aSelf._positionPinnedTabsWithDelayTimerArgs = null;
|
||||||
}, 0, this);
|
}, 0, this);
|
||||||
@ -832,7 +832,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
if (!(id in self.tabsHash))
|
if (!(id in self.tabsHash))
|
||||||
self.tabsHash[id] = aTab;
|
self.tabsHash[id] = aTab;
|
||||||
}
|
}
|
||||||
});
|
}).error(this.defaultDeferredErrorHandler);
|
||||||
if (!(id in this.tabsHash))
|
if (!(id in this.tabsHash))
|
||||||
this.tabsHash[id] = aTab;
|
this.tabsHash[id] = aTab;
|
||||||
}
|
}
|
||||||
@ -1068,7 +1068,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
node.style.position = '';
|
node.style.position = '';
|
||||||
node.style.visibility = '';
|
node.style.visibility = '';
|
||||||
}
|
}
|
||||||
});
|
}).error(this.defaultDeferredErrorHandler);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1088,7 +1088,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
{
|
{
|
||||||
this.initTabContentsOrder(tabs[i]);
|
this.initTabContentsOrder(tabs[i]);
|
||||||
}
|
}
|
||||||
});
|
}).error(this.defaultDeferredErrorHandler);
|
||||||
},
|
},
|
||||||
|
|
||||||
initTabbar : function TSTBrowser_initTabbar(aNewPosition, aOldPosition)
|
initTabbar : function TSTBrowser_initTabbar(aNewPosition, aOldPosition)
|
||||||
@ -1360,7 +1360,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
self.mTabBrowser.dispatchEvent(event);
|
self.mTabBrowser.dispatchEvent(event);
|
||||||
|
|
||||||
self.startRendering();
|
self.startRendering();
|
||||||
});
|
}).error(this.defaultDeferredErrorHandler);
|
||||||
|
|
||||||
pos = null;
|
pos = null;
|
||||||
scrollFrame = null;
|
scrollFrame = null;
|
||||||
@ -1494,7 +1494,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
TabsOnTop.enabled = !TabsOnTop.enabled;
|
TabsOnTop.enabled = !TabsOnTop.enabled;
|
||||||
this.Deferred.next(function() {
|
this.Deferred.next(function() {
|
||||||
TabsOnTop.enabled = !TabsOnTop.enabled;
|
TabsOnTop.enabled = !TabsOnTop.enabled;
|
||||||
});
|
}).error(this.defaultDeferredErrorHandler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1522,7 +1522,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
self.updateFloatingTabbar(self.kTABBAR_UPDATE_BY_APPEARANCE_CHANGE);
|
self.updateFloatingTabbar(self.kTABBAR_UPDATE_BY_APPEARANCE_CHANGE);
|
||||||
self._fireTabbarStateChangedEvent();
|
self._fireTabbarStateChangedEvent();
|
||||||
self.startRendering();
|
self.startRendering();
|
||||||
});
|
}).error(this.defaultDeferredErrorHandler);
|
||||||
|
|
||||||
this.allowSubtreeCollapseExpand = this.getTreePref('allowSubtreeCollapseExpand.'+orient) ;
|
this.allowSubtreeCollapseExpand = this.getTreePref('allowSubtreeCollapseExpand.'+orient) ;
|
||||||
this.maxTreeLevel = this.getTreePref('maxTreeLevel.'+orient);
|
this.maxTreeLevel = this.getTreePref('maxTreeLevel.'+orient);
|
||||||
@ -2295,13 +2295,17 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
case 'extensions.treestyletab.counter.role.horizontal':
|
case 'extensions.treestyletab.counter.role.horizontal':
|
||||||
if (!this.isVertical) {
|
if (!this.isVertical) {
|
||||||
let self = this;
|
let self = this;
|
||||||
this.Deferred.next(function() { self.updateAllTabsCount(); });
|
this.Deferred
|
||||||
|
.next(function() { self.updateAllTabsCount(); })
|
||||||
|
.error(this.defaultDeferredErrorHandler);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 'extensions.treestyletab.counter.role.vertical':
|
case 'extensions.treestyletab.counter.role.vertical':
|
||||||
if (this.isVertical) {
|
if (this.isVertical) {
|
||||||
let self = this;
|
let self = this;
|
||||||
this.Deferred.next(function() { self.updateAllTabsCount(); });
|
this.Deferred
|
||||||
|
.next(function() { self.updateAllTabsCount(); })
|
||||||
|
.error(this.defaultDeferredErrorHandler);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2549,7 +2553,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
var self = this;
|
var self = this;
|
||||||
this.cancelingPerformingAutoScroll = this.Deferred.wait(0.3).next(function() {
|
this.cancelingPerformingAutoScroll = this.Deferred.wait(0.3).next(function() {
|
||||||
self.cancelingPerformingAutoScroll = null;
|
self.cancelingPerformingAutoScroll = null;
|
||||||
});
|
}).error(this.defaultDeferredErrorHandler);
|
||||||
},
|
},
|
||||||
|
|
||||||
shouldCancelEnsureElementIsVisible : function TSTBRowser_shouldCancelEnsureElementIsVisible()
|
shouldCancelEnsureElementIsVisible : function TSTBRowser_shouldCancelEnsureElementIsVisible()
|
||||||
@ -2832,7 +2836,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
b.removeTab(parentTab, { animate : true });
|
b.removeTab(parentTab, { animate : true });
|
||||||
parentTab = null;
|
parentTab = null;
|
||||||
b = null;
|
b = null;
|
||||||
});
|
}).error(this.defaultDeferredErrorHandler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!nextFocusedTab) {
|
else if (!nextFocusedTab) {
|
||||||
@ -2933,7 +2937,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
let tabs = trees[i];
|
let tabs = trees[i];
|
||||||
self.fireTabSubtreeClosedEvent(b, tabs[0], tabs);
|
self.fireTabSubtreeClosedEvent(b, tabs[0], tabs);
|
||||||
}
|
}
|
||||||
});
|
}).error(this.defaultDeferredErrorHandler);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@ -3339,7 +3343,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
* Now we can decrement the counter.
|
* Now we can decrement the counter.
|
||||||
*/
|
*/
|
||||||
self.windowService.restoringCount--;
|
self.windowService.restoringCount--;
|
||||||
});
|
}).error(self.defaultDeferredErrorHandler);
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
if (!tab.selected &&
|
if (!tab.selected &&
|
||||||
@ -4395,7 +4399,8 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
.next(function() {
|
.next(function() {
|
||||||
if (self.window.TabsOnTop.enabled != aEnabled)
|
if (self.window.TabsOnTop.enabled != aEnabled)
|
||||||
self.window.TabsOnTop.enabled = aEnabled;
|
self.window.TabsOnTop.enabled = aEnabled;
|
||||||
});
|
})
|
||||||
|
.error(this.defaultDeferredErrorHandler);
|
||||||
},
|
},
|
||||||
|
|
||||||
onTreeStyleTabPrintPreviewEntered : function TSTBrowser_onTreeStyleTabPrintPreviewEntered(aEvent)
|
onTreeStyleTabPrintPreviewEntered : function TSTBrowser_onTreeStyleTabPrintPreviewEntered(aEvent)
|
||||||
@ -5760,7 +5765,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
self.smoothScrollTo(aEndX, aEndY, parseInt(aDuration * 0.5));
|
self.smoothScrollTo(aEndX, aEndY, parseInt(aDuration * 0.5));
|
||||||
self = null;
|
self = null;
|
||||||
scrollBoxObject = null;
|
scrollBoxObject = null;
|
||||||
});
|
}).error(self.defaultDeferredErrorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
b = null;
|
b = null;
|
||||||
@ -5910,7 +5915,8 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
.next(function() {
|
.next(function() {
|
||||||
animateElement.removeAttribute(attrName);
|
animateElement.removeAttribute(attrName);
|
||||||
self.lastNotifyBackgroundTabAnimation = null;
|
self.lastNotifyBackgroundTabAnimation = null;
|
||||||
});
|
})
|
||||||
|
.error(this.defaultDeferredErrorHandler);
|
||||||
},
|
},
|
||||||
|
|
||||||
restoreTree : function TSTBrowser_restoreTree()
|
restoreTree : function TSTBrowser_restoreTree()
|
||||||
|
@ -763,7 +763,7 @@ var TreeStyleTabUtils = {
|
|||||||
target.removeEventListener(type, listener, false);
|
target.removeEventListener(type, listener, false);
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
});
|
}).error(this.defaultDeferredErrorHandler);
|
||||||
|
|
||||||
target.addEventListener(type, listener, false);
|
target.addEventListener(type, listener, false);
|
||||||
|
|
||||||
@ -804,6 +804,14 @@ var TreeStyleTabUtils = {
|
|||||||
throw error;
|
throw error;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
defaultDeferredErrorHandler : function TSTUtils_defaultDeferredErrorHandler(aError)
|
||||||
|
{
|
||||||
|
if (aError.stack)
|
||||||
|
Components.utils.reportError(aError.message+'\n'+aError.stack);
|
||||||
|
else
|
||||||
|
Components.utils.reportError(aError);
|
||||||
|
},
|
||||||
|
|
||||||
// event
|
// event
|
||||||
|
|
||||||
isNewTabAction : function TSTUtils_isNewTabAction(aEvent)
|
isNewTabAction : function TSTUtils_isNewTabAction(aEvent)
|
||||||
@ -1753,7 +1761,7 @@ var TreeStyleTabUtils = {
|
|||||||
let self = this;
|
let self = this;
|
||||||
this.Deferred.next(function() {
|
this.Deferred.next(function() {
|
||||||
self.stopToOpenChildTab(aFrameOrTabBrowser);
|
self.stopToOpenChildTab(aFrameOrTabBrowser);
|
||||||
});
|
}).error(this.defaultDeferredErrorHandler);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -1804,7 +1812,7 @@ var TreeStyleTabUtils = {
|
|||||||
let self = this;
|
let self = this;
|
||||||
this.Deferred.next(function() {
|
this.Deferred.next(function() {
|
||||||
self.stopToOpenChildTab(aFrameOrTabBrowser);
|
self.stopToOpenChildTab(aFrameOrTabBrowser);
|
||||||
});
|
}).error(this.defaultDeferredErrorHandler);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -1840,7 +1848,7 @@ var TreeStyleTabUtils = {
|
|||||||
let self = this;
|
let self = this;
|
||||||
this.Deferred.next(function() {
|
this.Deferred.next(function() {
|
||||||
self.stopToOpenChildTab(aFrameOrTabBrowser);
|
self.stopToOpenChildTab(aFrameOrTabBrowser);
|
||||||
});
|
}).error(this.defaultDeferredErrorHandler);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -941,7 +941,7 @@ TreeStyleTabWindow.prototype = {
|
|||||||
|
|
||||||
this.Deferred.next(function() {
|
this.Deferred.next(function() {
|
||||||
b.treeStyleTab.fixTooNarrowTabbar();
|
b.treeStyleTab.fixTooNarrowTabbar();
|
||||||
});
|
}).error(this.defaultDeferredErrorHandler);
|
||||||
},
|
},
|
||||||
onTabbarResizing : function TSTWindow_onTabbarResizing(aEvent)
|
onTabbarResizing : function TSTWindow_onTabbarResizing(aEvent)
|
||||||
{
|
{
|
||||||
@ -1425,7 +1425,7 @@ TreeStyleTabWindow.prototype = {
|
|||||||
else if (next) {
|
else if (next) {
|
||||||
b.treeStyleTab.moveTabSubtreeTo(root, next._tPos);
|
b.treeStyleTab.moveTabSubtreeTo(root, next._tPos);
|
||||||
}
|
}
|
||||||
});
|
}).error(this.defaultDeferredErrorHandler);
|
||||||
},
|
},
|
||||||
createSubTree : function() { return this.createSubtree.apply(this, arguments); }, // obsolete, for backward compatibility
|
createSubTree : function() { return this.createSubtree.apply(this, arguments); }, // obsolete, for backward compatibility
|
||||||
|
|
||||||
@ -1593,9 +1593,7 @@ TreeStyleTabWindow.prototype = {
|
|||||||
remoteService = null;
|
remoteService = null;
|
||||||
remoteMultipleTabService = null;
|
remoteMultipleTabService = null;
|
||||||
})
|
})
|
||||||
.error(function(e) {
|
.error(this.defaultDeferredErrorHandler);
|
||||||
Application.console.log(e+'\n'+e.stack)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user