Firefox download with internal script

Discussion of third-party/unofficial Firefox/Thunderbird/SeaMonkey builds.
Post Reply
Sintax
Posts: 2
Joined: September 6th, 2014, 10:29 pm

Firefox download with internal script

Post by Sintax »

Does anyone know how can I replace the download manager when I click a link for downloading a file with an internal script.I'm thinking th e code for the download manager to start on the event of clicking a link is stored in a .js file that is packed inside the omni.ja file but I don't know the exact piece of code that does that nor the exact file that has the code; and how to replace the code with my internal script so that when I click a download link for a file my script starts the download (it's a downloading script that uses a internal download manager that supports arguments).Any help on the matter is appreciated, please don't point out to extensions/addons that are on the addons.mozilla.org site that have that funcionality.
BigMadDrongo
Posts: 6
Joined: September 6th, 2014, 5:14 am

Re: Firefox download with internal script

Post by BigMadDrongo »

Hi

This is an intriguing question. I don't know either, but since nobody else gives an answer I'll see what I can find, just out of curiosity. Google provides no relevant answers as far as I can see.
The addons to replace the downloadmanager must know how to take over from the inbuilt downloadmanager though.
Did you try to install an addon temporarily to see what files this will change? Or the documentation on the add-on's homepage?

Do you have any additional info, even if it is just what you tried that didn' solve the problem? Then post it here please. I hav to go to work now, but I'll take a look this evening.

Greetings,
Drongo

Shoot all extremists!


If you have tried
BigMadDrongo
Posts: 6
Joined: September 6th, 2014, 5:14 am

Re: Firefox download with internal script

Post by BigMadDrongo »

It's a PITA (pain in the behind) but this may be helpful

https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Downloads.jsm#Conversion_from_nsIDownloadManager

Drongo

Save a cat
Eat a dog
BigMadDrongo
Posts: 6
Joined: September 6th, 2014, 5:14 am

Re: Firefox download with internal script

Post by BigMadDrongo »

Or create your own add-on that opens your script - also a PiTA

https://developer.mozilla.org/en-US/Add-ons/SDK

Drongo

Man made booze
God made grass
Whom do you trust?
Sintax
Posts: 2
Joined: September 6th, 2014, 10:29 pm

Re: Firefox download with internal script

Post by Sintax »

Thanks BigMadDrongo for your reply and information, I'm replying so late because I didn't noticed any answers from anyone.I did try to solve "the problem" myself but the lack of javascript and DOM scripting left me looking at the internal .js files with very big eyes and with question signs over my head sort of speaking.I took a different aproach: started looking at the internal files for the code that initializes the download manager and so far the only files that I found and have anything to do with the download manager are browser.jar -> content/browser.js

// Initialize the download manager some time after the app starts so that
// auto-resume downloads begin (such as after crashing or quitting with
// active downloads) and speeds up the first-load of the download manager UI.
// If the user manually opens the download manager before the timeout, the
// downloads will start right away, and getting the service again won't hurt.
setTimeout(function() {
gDownloadMgr = Cc["@mozilla.org/download-manager;1"].
getService(Ci.nsIDownloadManager);

// Initialize the downloads monitor panel listener
DownloadMonitorPanel.init();
}, 10000);

function BrowserDownloadsUI()
{
Cc["@mozilla.org/download-manager-ui;1"].
getService(Ci.nsIDownloadManagerUI).show(window);
}

browser.jar -> openlocation.js
or so I think, like I said the lack of javascript/DOM scripting and the inner workings of firefox internal components (which by the way as you pointed out not only seems to change alot but is also a pain in the behind for addon developers & other people) knowledge left me "stranded" from what I wanted to achieve.I know that is possible to make this I just don't know how, if you're asking youreself how do I know, this adress explains it : http://www.polinux.upv.es/mozilla/mejoras.php?idioma=en which hooked a internal script to the "Save link target as..." , but that was on a older firefox version and much changed since then also I wanted to do the opposite, to hook an script (in the firefox core files) so that when I click a link for the download it will download the file with my capable of arguments internal downloader and leaving the "Save link target as..." just in case I need the normal firefox downloader.As far as the addons go there is an addon that lets me start an url or link with another internal (os internal I mean) application, its called launchy, but the problem with launchy is that every time I want to start a download with my internal script I have to right click the link and select launchy->myscript and that can get annoying at some point.Looking at lauchy internal .js files just for the part that does what I want without the whole selection part left me with headaches beacuse of the same lack of javascript/DOM and internal firefox components knowledge but also because with launchy you have to right click a link and then the selection thing.I want a direct click on link to initialize the script, so the lauchy .js files dont offer much help for someone with my knowledge.Anyway thanks again for the info and the reply.
Post Reply