From 03797626cf857932810a8c336508093628022b17 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 11 Mar 2015 17:54:32 -0600 Subject: Fix vAPI.download across all platforms --- platform/safari/vapi-background.js | 3 ++- platform/safari/vapi-common.js | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'platform/safari') diff --git a/platform/safari/vapi-background.js b/platform/safari/vapi-background.js index 143693c..be51b0e 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 ac47849..936d1e8 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(); }; -- cgit v1.1