Unable to use DownloadLastDir.jsm as in documentation

RESOLVED INCOMPLETE

Status

Add-on SDK
Documentation
RESOLVED INCOMPLETE
3 years ago
7 months ago

People

(Reporter: bangar1991, Unassigned)

Tracking

({APIchange, doc-bug-filed})

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [specification][type:bug])

(Reporter)

Description

3 years ago
What did you do?
================
1. Tried to import DownloadLastDir.jsm as:
let {Cu} = require('chrome');
let gDownloadLastDir = Cu.import("resource://gre/modules/DownloadLastDir.jsm").gDownloadLastDir;
2. Proceeded to use gDownloadLastDir object.
3. Tried DownloadLastDir instead of gDownloadLastDir:
let DownloadLastDir = Cu.import("resource://gre/modules/DownloadLastDir.jsm").DownloadLastDir;
4. Proceeded to use DownloadLastDir object.

What happened?
==============
After (2), JPM shows an error saying gDownloadLastDir is undefined. After some investigating about EXPORTED_SYMBOLS property of object returned by:
let obj = Cu.import("resource://gre/modules/DownloadLastDir.jsm");
it seems that DownloadLastDir is the object being exported, not gDownloadLastDir. My testing confirmed this, so I reflected MDN documentation to the same effect, pending Technical review.
Unfortunately, even though DownloadLastDir is not undefined, I can't access any of its useful properties (like file, getFileAsync(), etc.) which are all part of its prototype object.


What should have happened?
==========================
gDownloadLastDir should have worked as documented. If the API has been updated to export DownloadLastDir instead, great. But its properties should be accessible, even those that are in the prototype (in this case all of them are in prototype).

Is there anything else we should know?
======================================
(Reporter)

Updated

3 years ago
Component: General → General
Keywords: APIchange, doc-bug-filed
OS: Other → Linux
Product: Mozilla Developer Network → Add-on SDK
Hardware: All → x86_64
(Reporter)

Updated

3 years ago
Component: General → Documentation
https://bugzilla.mozilla.org/show_bug.cgi?id=1399562
Status: UNCONFIRMED → RESOLVED
Last Resolved: 7 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.