mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1207496 - Part 4: Remove use of expression closure from services/sync/. r=gps
This commit is contained in:
parent
3278943549
commit
291c1c33ee
@ -49,7 +49,9 @@ ClientEngine.prototype = {
|
||||
_trackerObj: ClientsTracker,
|
||||
|
||||
// Always sync client data as it controls other sync behavior
|
||||
get enabled() true,
|
||||
get enabled() {
|
||||
return true;
|
||||
},
|
||||
|
||||
get lastRecordUpload() {
|
||||
return Svc.Prefs.get(this.name + ".lastRecordUpload", 0);
|
||||
@ -102,7 +104,9 @@ ClientEngine.prototype = {
|
||||
let localID = Svc.Prefs.get("client.GUID", "");
|
||||
return localID == "" ? this.localID = Utils.makeGUID() : localID;
|
||||
},
|
||||
set localID(value) Svc.Prefs.set("client.GUID", value),
|
||||
set localID(value) {
|
||||
Svc.Prefs.set("client.GUID", value);
|
||||
},
|
||||
|
||||
get brandName() {
|
||||
let brand = new StringBundle("chrome://branding/locale/brand.properties");
|
||||
@ -116,10 +120,16 @@ ClientEngine.prototype = {
|
||||
|
||||
return this.localName = Utils.getDefaultDeviceName();
|
||||
},
|
||||
set localName(value) Svc.Prefs.set("client.name", value),
|
||||
set localName(value) {
|
||||
Svc.Prefs.set("client.name", value);
|
||||
},
|
||||
|
||||
get localType() Svc.Prefs.get("client.type", "desktop"),
|
||||
set localType(value) Svc.Prefs.set("client.type", value),
|
||||
get localType() {
|
||||
return Svc.Prefs.get("client.type", "desktop");
|
||||
},
|
||||
set localType(value) {
|
||||
Svc.Prefs.set("client.type", value);
|
||||
},
|
||||
|
||||
isMobile: function isMobile(id) {
|
||||
if (this._store._remoteClients[id])
|
||||
|
@ -109,7 +109,9 @@ FormEngine.prototype = {
|
||||
|
||||
syncPriority: 6,
|
||||
|
||||
get prefName() "history",
|
||||
get prefName() {
|
||||
return "history";
|
||||
},
|
||||
|
||||
_findDupe: function _findDupe(item) {
|
||||
return FormWrapper.getGUID(item.name, item.value);
|
||||
|
@ -15,12 +15,14 @@ var lazies = {
|
||||
};
|
||||
|
||||
function lazyImport(module, dest, props) {
|
||||
function getter(prop) function() {
|
||||
let ns = {};
|
||||
Components.utils.import(module, ns);
|
||||
delete dest[prop];
|
||||
return dest[prop] = ns[prop];
|
||||
};
|
||||
function getter(prop) {
|
||||
return function() {
|
||||
let ns = {};
|
||||
Components.utils.import(module, ns);
|
||||
delete dest[prop];
|
||||
return dest[prop] = ns[prop];
|
||||
};
|
||||
}
|
||||
props.forEach(function (prop) { dest.__defineGetter__(prop, getter(prop)); });
|
||||
}
|
||||
|
||||
|
@ -61,20 +61,40 @@ SyncScheduler.prototype = {
|
||||
},
|
||||
|
||||
// nextSync is in milliseconds, but prefs can't hold that much
|
||||
get nextSync() Svc.Prefs.get("nextSync", 0) * 1000,
|
||||
set nextSync(value) Svc.Prefs.set("nextSync", Math.floor(value / 1000)),
|
||||
get nextSync() {
|
||||
return Svc.Prefs.get("nextSync", 0) * 1000;
|
||||
},
|
||||
set nextSync(value) {
|
||||
Svc.Prefs.set("nextSync", Math.floor(value / 1000));
|
||||
},
|
||||
|
||||
get syncInterval() Svc.Prefs.get("syncInterval", this.singleDeviceInterval),
|
||||
set syncInterval(value) Svc.Prefs.set("syncInterval", value),
|
||||
get syncInterval() {
|
||||
return Svc.Prefs.get("syncInterval", this.singleDeviceInterval);
|
||||
},
|
||||
set syncInterval(value) {
|
||||
Svc.Prefs.set("syncInterval", value);
|
||||
},
|
||||
|
||||
get syncThreshold() Svc.Prefs.get("syncThreshold", SINGLE_USER_THRESHOLD),
|
||||
set syncThreshold(value) Svc.Prefs.set("syncThreshold", value),
|
||||
get syncThreshold() {
|
||||
return Svc.Prefs.get("syncThreshold", SINGLE_USER_THRESHOLD);
|
||||
},
|
||||
set syncThreshold(value) {
|
||||
Svc.Prefs.set("syncThreshold", value);
|
||||
},
|
||||
|
||||
get globalScore() Svc.Prefs.get("globalScore", 0),
|
||||
set globalScore(value) Svc.Prefs.set("globalScore", value),
|
||||
get globalScore() {
|
||||
return Svc.Prefs.get("globalScore", 0);
|
||||
},
|
||||
set globalScore(value) {
|
||||
Svc.Prefs.set("globalScore", value);
|
||||
},
|
||||
|
||||
get numClients() Svc.Prefs.get("numClients", 0),
|
||||
set numClients(value) Svc.Prefs.set("numClients", value),
|
||||
get numClients() {
|
||||
return Svc.Prefs.get("numClients", 0);
|
||||
},
|
||||
set numClients(value) {
|
||||
Svc.Prefs.set("numClients", value);
|
||||
},
|
||||
|
||||
init: function init() {
|
||||
this._log.level = Log.Level[Svc.Prefs.get("log.logger.service.main")];
|
||||
|
@ -196,7 +196,9 @@ CryptoWrapper.prototype = {
|
||||
},
|
||||
|
||||
// The custom setter below masks the parent's getter, so explicitly call it :(
|
||||
get id() WBORecord.prototype.__lookupGetter__("id").call(this),
|
||||
get id() {
|
||||
return WBORecord.prototype.__lookupGetter__("id").call(this);
|
||||
},
|
||||
|
||||
// Keep both plaintext and encrypted versions of the id to verify integrity
|
||||
set id(val) {
|
||||
@ -356,8 +358,9 @@ CollectionKeyManager.prototype = {
|
||||
/**
|
||||
* Create a WBO for the current keys.
|
||||
*/
|
||||
asWBO: function(collection, id)
|
||||
this._makeWBO(this._collections, this._default),
|
||||
asWBO: function(collection, id) {
|
||||
return this._makeWBO(this._collections, this._default);
|
||||
},
|
||||
|
||||
/**
|
||||
* Compute a new default key, and new keys for any specified collections.
|
||||
@ -560,14 +563,14 @@ Collection.prototype = {
|
||||
},
|
||||
|
||||
// Apply the action to a certain set of ids
|
||||
get ids() this._ids,
|
||||
get ids() { return this._ids; },
|
||||
set ids(value) {
|
||||
this._ids = value;
|
||||
this._rebuildURL();
|
||||
},
|
||||
|
||||
// Limit how many records to get
|
||||
get limit() this._limit,
|
||||
get limit() { return this._limit; },
|
||||
set limit(value) {
|
||||
this._limit = value;
|
||||
this._rebuildURL();
|
||||
|
@ -134,7 +134,9 @@ AsyncResource.prototype = {
|
||||
//
|
||||
// Get and set the data encapulated in the resource.
|
||||
_data: null,
|
||||
get data() this._data,
|
||||
get data() {
|
||||
return this._data;
|
||||
},
|
||||
set data(value) {
|
||||
this._data = value;
|
||||
},
|
||||
|
@ -79,7 +79,9 @@ Sync11Service.prototype = {
|
||||
metaURL: null,
|
||||
cryptoKeyURL: null,
|
||||
|
||||
get serverURL() Svc.Prefs.get("serverURL"),
|
||||
get serverURL() {
|
||||
return Svc.Prefs.get("serverURL");
|
||||
},
|
||||
set serverURL(value) {
|
||||
if (!value.endsWith("/")) {
|
||||
value += "/";
|
||||
@ -94,7 +96,9 @@ Sync11Service.prototype = {
|
||||
Svc.Prefs.reset("clusterURL");
|
||||
},
|
||||
|
||||
get clusterURL() Svc.Prefs.get("clusterURL", ""),
|
||||
get clusterURL() {
|
||||
return Svc.Prefs.get("clusterURL", "");
|
||||
},
|
||||
set clusterURL(value) {
|
||||
Svc.Prefs.set("clusterURL", value);
|
||||
this._updateCachedURLs();
|
||||
|
@ -477,7 +477,7 @@ this.Utils = {
|
||||
|
||||
// 20-char sync key.
|
||||
if (pp.length == 23 &&
|
||||
[5, 11, 17].every(function(i) pp[i] == '-')) {
|
||||
[5, 11, 17].every(i => pp[i] == '-')) {
|
||||
|
||||
return pp.slice(0, 5) + pp.slice(6, 11)
|
||||
+ pp.slice(12, 17) + pp.slice(18, 23);
|
||||
@ -485,7 +485,7 @@ this.Utils = {
|
||||
|
||||
// "Modern" 26-char key.
|
||||
if (pp.length == 31 &&
|
||||
[1, 7, 13, 19, 25].every(function(i) pp[i] == '-')) {
|
||||
[1, 7, 13, 19, 25].every(i => pp[i] == '-')) {
|
||||
|
||||
return pp.slice(0, 1) + pp.slice(2, 7)
|
||||
+ pp.slice(8, 13) + pp.slice(14, 19)
|
||||
|
@ -85,12 +85,12 @@ function run_test() {
|
||||
do_check_eq(PlacesUtils.bookmarks.getKeywordForBookmark(id), null);
|
||||
|
||||
do_check_throws(
|
||||
function () PlacesUtils.annotations.getItemAnnotation(id, GENERATORURI_ANNO),
|
||||
() => PlacesUtils.annotations.getItemAnnotation(id, GENERATORURI_ANNO),
|
||||
Cr.NS_ERROR_NOT_AVAILABLE
|
||||
);
|
||||
|
||||
do_check_throws(
|
||||
function () PlacesUtils.annotations.getItemAnnotation(id, STATICTITLE_ANNO),
|
||||
() => PlacesUtils.annotations.getItemAnnotation(id, STATICTITLE_ANNO),
|
||||
Cr.NS_ERROR_NOT_AVAILABLE
|
||||
);
|
||||
|
||||
|
@ -51,7 +51,7 @@ add_task(function test_locally_changed_keys() {
|
||||
}]}]};
|
||||
delete Svc.Session;
|
||||
Svc.Session = {
|
||||
getBrowserState: function () JSON.stringify(myTabs)
|
||||
getBrowserState: () => JSON.stringify(myTabs)
|
||||
};
|
||||
|
||||
setBasicCredentials("johndoe", "password", passphrase);
|
||||
|
@ -60,7 +60,7 @@ add_test(function v4_upgrade() {
|
||||
}]}]};
|
||||
delete Svc.Session;
|
||||
Svc.Session = {
|
||||
getBrowserState: function () JSON.stringify(myTabs)
|
||||
getBrowserState: () => JSON.stringify(myTabs)
|
||||
};
|
||||
|
||||
Service.status.resetSync();
|
||||
@ -229,7 +229,7 @@ add_test(function v5_upgrade() {
|
||||
}]}]};
|
||||
delete Svc.Session;
|
||||
Svc.Session = {
|
||||
getBrowserState: function () JSON.stringify(myTabs)
|
||||
getBrowserState: () => JSON.stringify(myTabs)
|
||||
};
|
||||
|
||||
Service.status.resetSync();
|
||||
|
@ -41,7 +41,9 @@ function StirlingEngine() {
|
||||
StirlingEngine.prototype = {
|
||||
__proto__: SteamEngine.prototype,
|
||||
// This engine's enabled state is the same as the SteamEngine's.
|
||||
get prefName() "steam"
|
||||
get prefName() {
|
||||
return "steam";
|
||||
}
|
||||
};
|
||||
Service.engineManager.register(StirlingEngine);
|
||||
|
||||
|
@ -15,7 +15,9 @@ function fakeSvcWinMediator() {
|
||||
getEnumerator: function() {
|
||||
return {
|
||||
cnt: 2,
|
||||
hasMoreElements: function() this.cnt-- > 0,
|
||||
hasMoreElements: function() {
|
||||
return this.cnt-- > 0;
|
||||
},
|
||||
getNext: function() {
|
||||
let elt = {addTopics: [], remTopics: []};
|
||||
logs.push(elt);
|
||||
|
@ -15,31 +15,39 @@ function run_test() {
|
||||
}
|
||||
},
|
||||
|
||||
func: function() this.catch(function() {
|
||||
rightThis = this == obj;
|
||||
didCall = true;
|
||||
return 5;
|
||||
})(),
|
||||
func: function() {
|
||||
return this.catch(function() {
|
||||
rightThis = this == obj;
|
||||
didCall = true;
|
||||
return 5;
|
||||
})();
|
||||
},
|
||||
|
||||
throwy: function() this.catch(function() {
|
||||
rightThis = this == obj;
|
||||
didCall = true;
|
||||
throw 10;
|
||||
})(),
|
||||
throwy: function() {
|
||||
return this.catch(function() {
|
||||
rightThis = this == obj;
|
||||
didCall = true;
|
||||
throw 10;
|
||||
})();
|
||||
},
|
||||
|
||||
callbacky: function() this.catch(function() {
|
||||
rightThis = this == obj;
|
||||
didCall = true;
|
||||
throw 10;
|
||||
}, function(ex) {
|
||||
wasTen = (ex == 10)
|
||||
})(),
|
||||
callbacky: function() {
|
||||
return this.catch(function() {
|
||||
rightThis = this == obj;
|
||||
didCall = true;
|
||||
throw 10;
|
||||
}, function(ex) {
|
||||
wasTen = (ex == 10)
|
||||
})();
|
||||
},
|
||||
|
||||
lockedy: function() this.catch(function() {
|
||||
rightThis = this == obj;
|
||||
didCall = true;
|
||||
throw("Could not acquire lock.");
|
||||
})()
|
||||
lockedy: function() {
|
||||
return this.catch(function() {
|
||||
rightThis = this == obj;
|
||||
didCall = true;
|
||||
throw("Could not acquire lock.");
|
||||
})();
|
||||
}
|
||||
};
|
||||
|
||||
_("Make sure a normal call will call and return");
|
||||
|
@ -6,8 +6,12 @@ function run_test() {
|
||||
base.prototype = {
|
||||
dst: {},
|
||||
|
||||
get a() "a",
|
||||
set b(val) this.dst.b = val + "!!!"
|
||||
get a() {
|
||||
return "a";
|
||||
},
|
||||
set b(val) {
|
||||
this.dst.b = val + "!!!";
|
||||
}
|
||||
};
|
||||
let src = new base();
|
||||
|
||||
|
@ -27,19 +27,23 @@ function run_test() {
|
||||
this._locked = false;
|
||||
},
|
||||
|
||||
func: function() this._lock("Test utils lock",
|
||||
function() {
|
||||
rightThis = this == obj;
|
||||
didCall = true;
|
||||
return 5;
|
||||
})(),
|
||||
func: function() {
|
||||
return this._lock("Test utils lock",
|
||||
function() {
|
||||
rightThis = this == obj;
|
||||
didCall = true;
|
||||
return 5;
|
||||
})();
|
||||
},
|
||||
|
||||
throwy: function() this._lock("Test utils lock throwy",
|
||||
function() {
|
||||
rightThis = this == obj;
|
||||
didCall = true;
|
||||
this.throwy();
|
||||
})()
|
||||
throwy: function() {
|
||||
return this._lock("Test utils lock throwy",
|
||||
function() {
|
||||
rightThis = this == obj;
|
||||
didCall = true;
|
||||
this.throwy();
|
||||
})();
|
||||
}
|
||||
};
|
||||
|
||||
_("Make sure a normal call will call and return");
|
||||
|
@ -9,17 +9,21 @@ function run_test() {
|
||||
trace: function() {}
|
||||
},
|
||||
|
||||
func: function() this.notify("bar", "baz", function() {
|
||||
rightThis = this == obj;
|
||||
didCall = true;
|
||||
return 5;
|
||||
})(),
|
||||
func: function() {
|
||||
return this.notify("bar", "baz", function() {
|
||||
rightThis = this == obj;
|
||||
didCall = true;
|
||||
return 5;
|
||||
})();
|
||||
},
|
||||
|
||||
throwy: function() this.notify("bad", "one", function() {
|
||||
rightThis = this == obj;
|
||||
didCall = true;
|
||||
throw 10;
|
||||
})()
|
||||
throwy: function() {
|
||||
return this.notify("bad", "one", function() {
|
||||
rightThis = this == obj;
|
||||
didCall = true;
|
||||
throw 10;
|
||||
})();
|
||||
}
|
||||
};
|
||||
|
||||
let state = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user