mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Remove unnecessary fallback code for downloading
This commit is contained in:
parent
650d86d5a9
commit
2e076f7e4e
4 changed files with 7 additions and 51 deletions
|
|
@ -36,7 +36,6 @@ var vAPI = self.vAPI = self.vAPI || {};
|
||||||
var chrome = self.chrome;
|
var chrome = self.chrome;
|
||||||
var manifest = chrome.runtime.getManifest();
|
var manifest = chrome.runtime.getManifest();
|
||||||
|
|
||||||
vAPI.isMainProcess = true;
|
|
||||||
vAPI.chrome = true;
|
vAPI.chrome = true;
|
||||||
|
|
||||||
var noopFunc = function(){};
|
var noopFunc = function(){};
|
||||||
|
|
|
||||||
|
|
@ -54,30 +54,9 @@ vAPI.download = function(details) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var a = document.createElement('a');
|
var a = document.createElement('a');
|
||||||
|
a.href = details.url;
|
||||||
if ( 'download' in a ) {
|
a.setAttribute('download', details.filename || '');
|
||||||
a.href = details.url;
|
a.dispatchEvent(new MouseEvent('click'));
|
||||||
a.setAttribute('download', details.filename || '');
|
|
||||||
a.dispatchEvent(new MouseEvent('click'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var request = {
|
|
||||||
what: 'gotoURL',
|
|
||||||
details: {
|
|
||||||
url: details.url,
|
|
||||||
index: -1
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if ( vAPI.isMainProcess ) {
|
|
||||||
vAPI.tabs.open(request.details);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var messager = vAPI.messaging.channel('_download');
|
|
||||||
messager.send(request);
|
|
||||||
messager.close();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ const {Services} = Cu.import('resource://gre/modules/Services.jsm', null);
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var vAPI = self.vAPI = self.vAPI || {};
|
var vAPI = self.vAPI = self.vAPI || {};
|
||||||
vAPI.isMainProcess = true;
|
|
||||||
vAPI.firefox = true;
|
vAPI.firefox = true;
|
||||||
vAPI.fennec = Services.appinfo.ID === '{aa3c5121-dab2-40e2-81ca-7ea25febc110}';
|
vAPI.fennec = Services.appinfo.ID === '{aa3c5121-dab2-40e2-81ca-7ea25febc110}';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,30 +50,9 @@ vAPI.download = function(details) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var a = document.createElement('a');
|
var a = document.createElement('a');
|
||||||
|
a.href = details.url;
|
||||||
if ( 'download' in a ) {
|
a.setAttribute('download', details.filename || '');
|
||||||
a.href = details.url;
|
a.dispatchEvent(new MouseEvent('click'));
|
||||||
a.setAttribute('download', details.filename || '');
|
|
||||||
a.dispatchEvent(new MouseEvent('click'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var request = {
|
|
||||||
what: 'gotoURL',
|
|
||||||
details: {
|
|
||||||
url: details.url,
|
|
||||||
index: -1
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if ( vAPI.isMainProcess ) {
|
|
||||||
vAPI.tabs.open(request.details);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var messager = vAPI.messaging.channel('_download');
|
|
||||||
messager.send(request);
|
|
||||||
messager.close();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue