diff --git a/platform/chromium/vapi-common.js b/platform/chromium/vapi-common.js index 3e95b3f10..77216462e 100644 --- a/platform/chromium/vapi-common.js +++ b/platform/chromium/vapi-common.js @@ -71,7 +71,7 @@ vAPI.download = function(details) { }; if ( vAPI.isMainProcess ) { - vAPI.tabs.open(request); + vAPI.tabs.open(request.details); return; } diff --git a/platform/firefox/vapi-common.js b/platform/firefox/vapi-common.js index 1e9f81c92..4ae771759 100644 --- a/platform/firefox/vapi-common.js +++ b/platform/firefox/vapi-common.js @@ -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(); }; diff --git a/platform/safari/vapi-background.js b/platform/safari/vapi-background.js index 143693ce8..be51b0e06 100644 --- a/platform/safari/vapi-background.js +++ b/platform/safari/vapi-background.js @@ -31,7 +31,8 @@ "use strict"; var vAPI = self.vAPI = self.vAPI || {}; - + + vAPI.isMainProcess = true; vAPI.safari = true; /******************************************************************************/ diff --git a/platform/safari/vapi-common.js b/platform/safari/vapi-common.js index ac47849cf..936d1e846 100644 --- a/platform/safari/vapi-common.js +++ b/platform/safari/vapi-common.js @@ -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(); };