Skip to content

Commit

Permalink
Call promise methords correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Dec 1, 2015
1 parent 8153de5 commit ee11d56
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions modules/wmctrl.jsm
Expand Up @@ -64,12 +64,12 @@ Wmctrl.prototype = {
var self = this;
if (!this.id)
return this.initId()
.next(function() {
.then(function() {
return self.raise();
});

return commandLineHelper.run(this.path, '-i', '-r', this.id, '-b', 'add,above')
.next(function() {
.then(function() {
return commandLineHelper.run(self.path, '-i', '-r', self.id, '-b', 'remove,above');
});
},
Expand All @@ -78,7 +78,7 @@ Wmctrl.prototype = {
{
var self = this;
return this.getWindowId(this.window)
.next(function(aWindowId) {
.then(function(aWindowId) {
return self.id = aWindowId;
});
},
Expand All @@ -88,7 +88,7 @@ Wmctrl.prototype = {
var self = this;
if (!this.path)
return Wmctrl.initPath()
.next(function() {
.then(function() {
return self.getWindowId(aWindow);
});

Expand All @@ -99,12 +99,12 @@ Wmctrl.prototype = {
aWindow.document.title = temporaryTitle;

return commandLineHelper.run(resolve('bin/wmctrl-list'), this.path, listFile.path)
.error(function() {
.catch(function() {
// we must restore the original title anyway!
if (aWindow.document.title == temporaryTitle)
aWindow.document.title = originalTitle;
})
.next(function() {
.then(function() {
aWindow.document.title = originalTitle;

var list = textIO.readFrom(listFile, 'UTF-8');
Expand Down Expand Up @@ -136,7 +136,7 @@ Wmctrl.initPath = function wmctrl_initPath() {

var pathFile = commandLineHelper.createTempFile('wmctrl-path');
commandLineHelper.run(resolve('bin/which-wmctrl'), pathFile.path)
.next(function() {
.then(function() {
var path = textIO.readFrom(pathFile, 'UTF-8').replace(/^\s+|\s+$/g, '');
pathFile.remove(true);
if (!path) {
Expand All @@ -147,7 +147,7 @@ Wmctrl.initPath = function wmctrl_initPath() {
aResolve(path);
}
})
.error(function() {
.catch(function() {
aReject(new Error(self.ERROR_WMCTRL_NOT_FOUND));
});
});;
Expand Down

0 comments on commit ee11d56

Please sign in to comment.