firefox SDK builder and MDN

We know that Mozilla has launched a web IDE for writing extensions with 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

Take the first code and Refine 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);



And nifiga it is not working. How, then, to use MDN for the SDK?

require("chrome"); made aliases changed... nothing.
October 3rd 19 at 02:52
1 answer
October 3rd 19 at 02:54
Solution
Myself experienced this in the Builder generated add-ons to a completely different architecture and programming interfaces. There own sdk and its structure code of the addon I can still sort things out and some things are generally in the form of a user script written. To understand more or less helps the manual for the sdk
The manual says that all must be) It's amazing, the Mozilla Foundation has produced so many pages, so many pelinkovac friend that just will not get from memory, Google account. I only helps decompiling other people's projects. since all the source code... the question of how they understood)
But still a gesture of some sort) - Pattie.Kuvalis commented on October 3rd 19 at 02:57
Yes, I also wonder how they figured out. Just yesterday I picked Firephp to add to the Protocol Chrome-Logger because I didn't have something similar to write and could not read the page headers. - Mertie5 commented on October 3rd 19 at 03:00
So this I addons.mozilla.org/en-US/developers/docs/sdk/latest/modules/sdk/request.html
The request went and all the headers in the response does not show a cookie does not read, shows simple stuff like Apache, etc. As I cannot understand otherwise, checking whether or not I am... - Pattie.Kuvalis commented on October 3rd 19 at 03:03

Find more questions by tags Extensions for browsersMozilla Firefox