Bug 948287 - [Download API] Accessing startTime attribute at download start fires NS_ERROR_UNEXPECTED in emulator. r=fabrice

This commit is contained in:
Ghislain Lacroix 2013-12-13 11:46:22 -05:00
Родитель cf45d3539c
Коммит 8fa7a3a3c3
1 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -198,6 +198,7 @@ function createDOMDownloadObject(aWindow, aDownload) {
function DOMDownloadImpl() {
debug("DOMDownloadImpl constructor ");
this.wrappedJSObject = this;
this.totalBytes = 0;
this.currentBytes = 0;
@ -205,9 +206,11 @@ function DOMDownloadImpl() {
this.path = null;
this.state = "stopped";
this.contentType = null;
this.startTime = Date.now();
this.error = null;
/* fields that require getters/setters */
this._startTime = new Date();
/* private fields */
this.id = null;
}
@ -244,6 +247,19 @@ DOMDownloadImpl.prototype = {
return this.__DOM_IMPL__.getEventHandler("onstatechange");
},
get startTime() {
return this._startTime;
},
set startTime(aStartTime) {
if (aStartTime instanceof Date) {
this._startTime = aStartTime;
}
else {
this._startTime = new Date(aStartTime);
}
},
_init: function(aWindow, aDownload) {
this._window = aWindow;
this.id = aDownload.id;