diff options
author | Chris <chris@chrismatic.io> | 2015-03-11 17:54:32 -0600 |
---|---|---|
committer | Chris <chris@chrismatic.io> | 2015-03-11 17:54:32 -0600 |
commit | 03797626cf857932810a8c336508093628022b17 (patch) | |
tree | cef801c68705ab166804088ff182b0c95d6f8c72 | |
parent | 60e36c0ffe19ba6a0edde8ec735b80a575dc4693 (diff) | |
download | uBlock-03797626cf857932810a8c336508093628022b17.zip uBlock-03797626cf857932810a8c336508093628022b17.tar.gz uBlock-03797626cf857932810a8c336508093628022b17.tar.bz2 |
Fix vAPI.download across all platforms
-rw-r--r-- | platform/chromium/vapi-common.js | 2 | ||||
-rw-r--r-- | platform/firefox/vapi-common.js | 14 | ||||
-rw-r--r-- | platform/safari/vapi-background.js | 3 | ||||
-rw-r--r-- | platform/safari/vapi-common.js | 13 |
4 files changed, 24 insertions, 8 deletions
diff --git a/platform/chromium/vapi-common.js b/platform/chromium/vapi-common.js index 3e95b3f..7721646 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 1e9f81c..4ae7717 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 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(); }; |