mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 09:07:54 +01: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}';
|
||||||
|
|
||||||
|
@ -1875,7 +1874,7 @@ vAPI.optionsObserver = {
|
||||||
register: function () {
|
register: function () {
|
||||||
var obs = Components.classes['@mozilla.org/observer-service;1'].getService(Components.interfaces.nsIObserverService);
|
var obs = Components.classes['@mozilla.org/observer-service;1'].getService(Components.interfaces.nsIObserverService);
|
||||||
obs.addObserver(this, "addon-options-displayed", false);
|
obs.addObserver(this, "addon-options-displayed", false);
|
||||||
|
|
||||||
cleanupTasks.push(this.unregister.bind(this));
|
cleanupTasks.push(this.unregister.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -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