Bug 941321 - add more failure-proofing to Australis customize mode enter/exit routines, r=mconley

--HG--
extra : rebase_source : 921fc4919704bb012fa0fa34426c3df56bccadd0
This commit is contained in:
Gijs Kruitbosch 2013-11-26 00:26:17 +01:00
parent 33603f47e0
commit 169b9b3dc4

View File

@ -15,6 +15,7 @@ const kAboutURI = "about:customizing";
const kDragDataTypePrefix = "text/toolbarwrapper-id/";
const kPlaceholderClass = "panel-customization-placeholder";
const kSkipSourceNodePref = "browser.uiCustomization.skipSourceNodeCheck";
const kMaxTransitionDurationMs = 2000;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource:///modules/CustomizableUI.jsm");
@ -322,9 +323,11 @@ CustomizeMode.prototype = {
let deck = this.document.getElementById("tab-view-deck");
let customizeTransitionEnd = function(aEvent) {
if (aEvent.originalTarget != deck || aEvent.propertyName != "padding-bottom") {
if (aEvent != "timedout" &&
(aEvent.originalTarget != deck || aEvent.propertyName != "padding-bottom")) {
return;
}
this.window.clearTimeout(catchAllTimeout);
deck.removeEventListener("transitionend", customizeTransitionEnd);
if (!aEntering) {
@ -350,6 +353,9 @@ CustomizeMode.prototype = {
this.document.documentElement.setAttribute("customize-exiting", true);
this.document.documentElement.removeAttribute("customize-entered");
}
let catchAll = () => customizeTransitionEnd("timedout");
let catchAllTimeout = this.window.setTimeout(catchAll, kMaxTransitionDurationMs);
return deferred.promise;
},
@ -551,7 +557,13 @@ CustomizeMode.prototype = {
deferredUnwrapToolbarItem: function(aWrapper) {
let deferred = Promise.defer();
dispatchFunction(function() {
deferred.resolve(this.unwrapToolbarItem(aWrapper));
let item = null;
try {
item = this.unwrapToolbarItem(aWrapper);
} catch (ex) {
Cu.reportError(ex);
}
deferred.resolve(item);
}.bind(this));
return deferred.promise;
},