Bug 945366 - [Download API] Accessing error attribute at download start fires NS_ERROR_UNEXPECTED. Relanding because of bad merge. r=gwagner

This commit is contained in:
glacroix@mozilla.com 2014-01-08 16:21:46 -08:00
parent 535a7cd23f
commit f9d0889611
3 changed files with 13 additions and 9 deletions

View File

@ -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;
},

View File

@ -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);

View File

@ -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();