mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changesets 7bfa96b421ea and da9faa259da1 (bug 1095506) for mochitest-bc failures.
This commit is contained in:
parent
d30b750923
commit
233b87b070
@ -477,16 +477,6 @@ this.Download.prototype = {
|
||||
// Update the download error, unless a new attempt already started. The
|
||||
// change in the status property is notified in the finally block.
|
||||
if (this._currentAttempt == currentAttempt || !this._currentAttempt) {
|
||||
if (!(ex instanceof DownloadError)) {
|
||||
let properties = {innerException: ex};
|
||||
|
||||
if (ex.message) {
|
||||
properties.message = ex.message;
|
||||
}
|
||||
|
||||
ex = new DownloadError(properties);
|
||||
}
|
||||
|
||||
this.error = ex;
|
||||
}
|
||||
throw ex;
|
||||
@ -920,8 +910,8 @@ this.Download.prototype = {
|
||||
serializable.saver = saver;
|
||||
}
|
||||
|
||||
if (this.error) {
|
||||
serializable.errorObj = this.error.toSerializable();
|
||||
if (this.error && ("message" in this.error)) {
|
||||
serializable.error = { message: this.error.message };
|
||||
}
|
||||
|
||||
if (this.startTime) {
|
||||
@ -929,8 +919,8 @@ this.Download.prototype = {
|
||||
}
|
||||
|
||||
// These are serialized unless they are false, null, or empty strings.
|
||||
for (let property of kPlainSerializableDownloadProperties) {
|
||||
if (this[property]) {
|
||||
for (let property of kSerializableDownloadProperties) {
|
||||
if (property != "error" && property != "startTime" && this[property]) {
|
||||
serializable[property] = this[property];
|
||||
}
|
||||
}
|
||||
@ -963,9 +953,10 @@ this.Download.prototype = {
|
||||
/**
|
||||
* Defines which properties of the Download object are serializable.
|
||||
*/
|
||||
const kPlainSerializableDownloadProperties = [
|
||||
const kSerializableDownloadProperties = [
|
||||
"succeeded",
|
||||
"canceled",
|
||||
"error",
|
||||
"totalBytes",
|
||||
"hasPartialData",
|
||||
"tryToKeepPartialData",
|
||||
@ -1020,22 +1011,17 @@ Download.fromSerializable = function (aSerializable) {
|
||||
download.startTime = new Date(time);
|
||||
}
|
||||
|
||||
if ("errorObj" in aSerializable) {
|
||||
download.error = DownloadError.fromSerializable(aSerializable.errorObj);
|
||||
}
|
||||
|
||||
for (let property of kPlainSerializableDownloadProperties) {
|
||||
for (let property of kSerializableDownloadProperties) {
|
||||
if (property in aSerializable) {
|
||||
download[property] = aSerializable[property];
|
||||
}
|
||||
}
|
||||
|
||||
deserializeUnknownProperties(download, aSerializable, property =>
|
||||
kPlainSerializableDownloadProperties.indexOf(property) == -1 &&
|
||||
kSerializableDownloadProperties.indexOf(property) == -1 &&
|
||||
property != "startTime" &&
|
||||
property != "source" &&
|
||||
property != "target" &&
|
||||
property != "error" &&
|
||||
property != "saver");
|
||||
|
||||
return download;
|
||||
@ -1277,10 +1263,6 @@ this.DownloadError = function (aProperties)
|
||||
this.becauseBlocked = true;
|
||||
}
|
||||
|
||||
if (aProperties.innerException) {
|
||||
this.innerException = aProperties.innerException;
|
||||
}
|
||||
|
||||
this.stack = new Error().stack;
|
||||
}
|
||||
|
||||
@ -1319,56 +1301,6 @@ this.DownloadError.prototype = {
|
||||
* and may be malware.
|
||||
*/
|
||||
becauseBlockedByReputationCheck: false,
|
||||
|
||||
/**
|
||||
* If this DownloadError was caused by an exception this property will
|
||||
* contain the original exception. This will not be serialized when saving
|
||||
* to the store.
|
||||
*/
|
||||
innerException: null,
|
||||
|
||||
/**
|
||||
* Returns a static representation of the current object state.
|
||||
*
|
||||
* @return A JavaScript object that can be serialized to JSON.
|
||||
*/
|
||||
toSerializable: function ()
|
||||
{
|
||||
let serializable = {
|
||||
result: this.result,
|
||||
message: this.message,
|
||||
becauseSourceFailed: this.becauseSourceFailed,
|
||||
becauseTargetFailed: this.becauseTargetFailed,
|
||||
becauseBlocked: this.becauseBlocked,
|
||||
becauseBlockedByParentalControls: this.becauseBlockedByParentalControls,
|
||||
becauseBlockedByReputationCheck: this.becauseBlockedByReputationCheck,
|
||||
};
|
||||
|
||||
serializeUnknownProperties(this, serializable);
|
||||
return serializable;
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new DownloadError object from its serializable representation.
|
||||
*
|
||||
* @param aSerializable
|
||||
* Serializable representation of a DownloadError object.
|
||||
*
|
||||
* @return The newly created DownloadError object.
|
||||
*/
|
||||
this.DownloadError.fromSerializable = function (aSerializable) {
|
||||
let e = new DownloadError(aSerializable);
|
||||
deserializeUnknownProperties(e, aSerializable, property =>
|
||||
property != "result" &&
|
||||
property != "message" &&
|
||||
property != "becauseSourceFailed" &&
|
||||
property != "becauseTargetFailed" &&
|
||||
property != "becauseBlocked" &&
|
||||
property != "becauseBlockedByParentalControls" &&
|
||||
property != "becauseBlockedByReputationCheck");
|
||||
|
||||
return e;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user