mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 984015 - GUIDHelper.getItemId should deliver itself as |this| to its internal executeAsync callback. r=?
This patch includes: * GUIDHelper.getItemGUID() must return a GUID. * GUIDHelper should resolve promises after other operations are finished. * GUIDHelper.getItemId should deliver itself as |this| to its internal executeAsync callback.
This commit is contained in:
parent
6a7faff5d3
commit
98e283add9
@ -1698,12 +1698,12 @@ let GUIDHelper = {
|
||||
if (row)
|
||||
itemId = row.getResultByIndex(0);
|
||||
},
|
||||
handleCompletion: function (aReason) {
|
||||
handleCompletion: aReason => {
|
||||
if (aReason == REASON_FINISHED && itemId != -1) {
|
||||
deferred.resolve(itemId);
|
||||
|
||||
this.ensureObservingRemovedItems();
|
||||
this.idsForGUIDs.set(aGUID, itemId);
|
||||
|
||||
deferred.resolve(itemId);
|
||||
}
|
||||
else if (itemId != -1) {
|
||||
deferred.reject("no item found for the given guid");
|
||||
@ -1719,7 +1719,7 @@ let GUIDHelper = {
|
||||
|
||||
getItemGUID: function (aItemId) {
|
||||
if (this.GUIDsForIds.has(aItemId))
|
||||
return Promise.resolve(this.GUIDsForIds.has(aItemId));
|
||||
return Promise.resolve(this.GUIDsForIds.get(aItemId));
|
||||
|
||||
let deferred = Promise.defer();
|
||||
let guid = "";
|
||||
@ -1732,12 +1732,12 @@ let GUIDHelper = {
|
||||
guid = row.getResultByIndex(1);
|
||||
}
|
||||
},
|
||||
handleCompletion: function (aReason) {
|
||||
handleCompletion: aReason => {
|
||||
if (aReason == REASON_FINISHED && guid) {
|
||||
deferred.resolve(guid);
|
||||
|
||||
this.ensureObservingRemovedItems();
|
||||
this.GUIDsForIds.set(aItemId, guid);
|
||||
|
||||
deferred.resolve(guid);
|
||||
}
|
||||
else if (!guid) {
|
||||
deferred.reject("no item found for the given itemId");
|
||||
|
Loading…
Reference in New Issue
Block a user