Answer the question
In order to leave comments, you need to log in
firefox SDK builder and MDN
We know that Mozilla has launched a web IDE for writing extensions using the SDK.
However, I can't figure out how to use the code from MDN
developer.mozilla.org/en-US/docs/Code_snippets/Downloading_Files
Taking the first code and ennobling it for the SDK
var {Cc, components , Cu} = require("chrome");
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
const WebBrowserPersist = components.Constructor("@mozilla.org/embedding/browser/nsWebBrowserPersist;1",
"nsIWebBrowserPersist");
var persist = WebBrowserPersist();
var targetFile = Services.dirsvc.get("Desk", Ci.nsIFile);
targetFile.append("file.bin");
// Obtain the privacy context of the browser window that the URL
// we are downloading comes from. If, and only if, the URL is not
// related to a window, null should be used instead.
persist.persistFlags = persist.PERSIST_FLAGS_FROM_CACHE
| persist.PERSIST_FLAGS_REPLACE_EXISTING_FILES;
persist.saveURI('https://forums.mozilla.org/addons/styles/ca_gen2/imageset/logo.png', null, null, null, "", 'c:\\temp\\', null);
Answer the question
In order to leave comments, you need to log in
I myself encountered this in Builder, add-ons are created with a completely different architecture and software interfaces. There, I still haven’t figured out everything with my sdk and my addon code structure, and I wrote some things in the form of a user script. The sdk manual more or less helps to figure it out
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question