Skip to content

Commit

Permalink
Fix vAPI.download across all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisaljoudi committed Mar 11, 2015
1 parent 60e36c0 commit 0379762
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion platform/chromium/vapi-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ vAPI.download = function(details) {
};

if ( vAPI.isMainProcess ) {
vAPI.tabs.open(request);
vAPI.tabs.open(request.details);
return;
}

Expand Down
14 changes: 11 additions & 3 deletions platform/firefox/vapi-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,22 @@ vAPI.download = function(details) {
a.dispatchEvent(new MouseEvent('click'));
return;
}
var messager = vAPI.messaging.channel('_download');
messager.send({

var request = {
what: 'gotoURL',
details: {
url: details.url,
index: -1
}
});
};

if ( vAPI.isMainProcess ) {
vAPI.tabs.open(request);
return;
}

var messager = vAPI.messaging.channel('_download');
messager.send(request);
messager.close();
};

Expand Down
3 changes: 2 additions & 1 deletion platform/safari/vapi-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"use strict";

var vAPI = self.vAPI = self.vAPI || {};


vAPI.isMainProcess = true;
vAPI.safari = true;

/******************************************************************************/
Expand Down
13 changes: 10 additions & 3 deletions platform/safari/vapi-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,21 @@ vAPI.download = function(details) {
a.dispatchEvent(new MouseEvent('click'));
return;
}
var messager = vAPI.messaging.channel('_download');
messager.send({
var request = {
what: 'gotoURL',
details: {
url: details.url,
index: -1
}
});
};

if ( vAPI.isMainProcess ) {
vAPI.tabs.open(request);
return;
}

var messager = vAPI.messaging.channel('_download');
messager.send(request);
messager.close();
};

Expand Down

0 comments on commit 0379762

Please sign in to comment.