diff --git a/modules/confirmWithTab.js b/modules/confirmWithTab.js index f1147688..240f2446 100644 --- a/modules/confirmWithTab.js +++ b/modules/confirmWithTab.js @@ -69,8 +69,9 @@ var confirmWithTab; }) ); + var checkbox; if (aOptions.checkbox) { - let checkbox = notification.ownerDocument.createElement('checkbox'); + checkbox = notification.ownerDocument.createElement('checkbox'); checkbox.setAttribute('label', aOptions.checkbox.label); if (aOptions.checkbox.checked) checkbox.setAttribute('checked', 'true'); @@ -80,11 +81,6 @@ var confirmWithTab; container.appendChild(checkbox); notification.appendChild(container); - - deferred.next(function(aButtonIndex) { - aOptions.checkbox.checked = checkbox.checked; - return aButtonIndex; - }); } var strip = b.tabContainer || b.mTabContainer; @@ -107,7 +103,12 @@ var confirmWithTab; }); notification.parentNode.addEventListener('DOMNodeRemoved', handleEvent, false); - return deferred; + return deferred + .next(function(aButtonIndex) { + if (aOptions.checkbox) + aOptions.checkbox.checked = checkbox.checked; + return aButtonIndex; + }); }; function getTabBrowserFromChild(aTabBrowserChild) diff --git a/modules/utils.js b/modules/utils.js index 72b0d74f..046d2341 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -437,7 +437,9 @@ var TreeStyleTabUtils = { { var behavior = this.undoCloseTabSetBehavior; if (!(behavior & this.kUNDO_ASK)) - return Deferred.next(); + return Deferred.next(function() { + return behavior; + }); if (behavior & this.kUNDO_CLOSE_SET) behavior ^= this.kUNDO_CLOSE_SET; @@ -461,10 +463,13 @@ var TreeStyleTabUtils = { }); }) .next(function(aButtonIndex) { - if (aButtonIndex == 0) + if (aButtonIndex == 0) { behavior |= self.kUNDO_CLOSE_SET; - if (checkbox.checked) + } + if (checkbox.checked) { + behavior ^= self.kUNDO_ASK; self.setTreePref('undoCloseTabSet.behavior', behavior); + } return behavior; }); },