diff --git a/dom/downloads/src/DownloadsAPI.js b/dom/downloads/src/DownloadsAPI.js index a87ca1d44457..668c24c70af2 100644 --- a/dom/downloads/src/DownloadsAPI.js +++ b/dom/downloads/src/DownloadsAPI.js @@ -206,9 +206,9 @@ function DOMDownloadImpl() { this.path = null; this.state = "stopped"; this.contentType = null; - this.error = null; /* fields that require getters/setters */ + this._error = null; this._startTime = new Date(); /* private fields */ @@ -247,6 +247,14 @@ DOMDownloadImpl.prototype = { return this.__DOM_IMPL__.getEventHandler("onstatechange"); }, + get error() { + return this._error; + }, + + set error(aError) { + this._error = aError; + }, + get startTime() { return this._startTime; }, diff --git a/dom/downloads/tests/test_downloads_basic.html b/dom/downloads/tests/test_downloads_basic.html index 943da3816307..c5ada1a0ea65 100644 --- a/dom/downloads/tests/test_downloads_basic.html +++ b/dom/downloads/tests/test_downloads_basic.html @@ -51,14 +51,10 @@ function checkConsistentDownloadAttributes(download) { todo(download.path === expectedDownloadPath, "Download path = " + expectedDownloadPath); - // bug 948287: Accessing startTime attribute at download start fires - // NS_ERROR_UNEXPECTED in emulator - //ok(download.startTime >= todayDate, - // "Download start time should be greater than or equal to today"); + ok(download.startTime >= todayDate, + "Download start time should be greater than or equal to today"); - // bug 945366: Accessing error attribute at download start fires - // NS_ERROR_UNEXPECTED in emulator - //is(download.error, null, "Download does not have an error"); + is(download.error, null, "Download does not have an error"); is(download.url, expectedServeURL, "Download URL = " + expectedServeURL); diff --git a/dom/webidl/Downloads.webidl b/dom/webidl/Downloads.webidl index e547868991b3..862e3b807c3f 100644 --- a/dom/webidl/Downloads.webidl +++ b/dom/webidl/Downloads.webidl @@ -59,7 +59,7 @@ interface DOMDownload : EventTarget { // A DOM error object, that will be not null when a download is stopped // because something failed. - readonly attribute DOMError error; + readonly attribute DOMError? error; // Pauses the download. Promise pause();