Bug 1028329 - Cancel delayed automove if there is an explicit interaction by the user. r=yzen

This commit is contained in:
Eitan Isaacson 2014-06-22 20:31:22 -07:00
parent f62927140f
commit 8b13d8981f

View File

@ -75,6 +75,9 @@ this.ContentControl.prototype = {
JSON.stringify(aMessage.json)];
});
// If we get an explicit message, we should immediately cancel any autoMove
this.cancelAutoMove();
try {
let func = this['handle' + aMessage.name.slice(9)]; // 'AccessFu:'.length
if (func) {
@ -381,8 +384,7 @@ this.ContentControl.prototype = {
* - moveMethod: pivot move method to use, default is 'moveNext',
*/
autoMove: function cc_autoMove(aAnchor, aOptions = {}) {
let win = this.window;
win.clearTimeout(this._autoMove);
this.cancelAutoMove();
let moveFunc = () => {
let vc = this.vc;
@ -432,12 +434,17 @@ this.ContentControl.prototype = {
};
if (aOptions.delay) {
this._autoMove = win.setTimeout(moveFunc, aOptions.delay);
this._autoMove = this.window.setTimeout(moveFunc, aOptions.delay);
} else {
moveFunc();
}
},
cancelAutoMove: function cc_cancelAutoMove() {
this.window.clearTimeout(this._autoMove);
this._autoMove = 0;
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference,
Ci.nsIMessageListener
])