mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1353542 - pre-script hand-written cleanup patch, r=Mossop.
This commit is contained in:
parent
7a4eb50360
commit
2e2f358aa9
@ -360,7 +360,7 @@ this.PanelMultiView = class {
|
||||
|
||||
showSubView(aViewId, aAnchor, aPreviousView, aAdopted = false) {
|
||||
const {document, window} = this;
|
||||
return window.Task.spawn(function*() {
|
||||
return Task.spawn(function*() {
|
||||
// Support passing in the node directly.
|
||||
let viewNode = typeof aViewId == "string" ? this.node.querySelector("#" + aViewId) : aViewId;
|
||||
if (!viewNode) {
|
||||
@ -417,7 +417,7 @@ this.PanelMultiView = class {
|
||||
let cancel = evt.defaultPrevented;
|
||||
if (detail.blockers.size) {
|
||||
try {
|
||||
let results = yield window.Promise.all(detail.blockers);
|
||||
let results = yield Promise.all(detail.blockers);
|
||||
cancel = cancel || results.some(val => val === false);
|
||||
} catch (e) {
|
||||
Cu.reportError(e);
|
||||
|
@ -319,7 +319,7 @@ add_task(function* test_expiration() {
|
||||
let now = null;
|
||||
let experiments = null;
|
||||
|
||||
let setDateAndRestartExperiments = new Task.async(function* (newDate) {
|
||||
let setDateAndRestartExperiments = Task.async(function* (newDate) {
|
||||
now = newDate;
|
||||
defineNow(gPolicy, now);
|
||||
|
||||
|
@ -734,6 +734,7 @@ function cleanUpForContext(extension, context) {
|
||||
/**
|
||||
* Generate a promise that produces the Collection for an extension.
|
||||
*
|
||||
* @param {CryptoCollection} cryptoCollection
|
||||
* @param {Extension} extension
|
||||
* The extension whose collection needs to
|
||||
* be opened.
|
||||
|
@ -1070,7 +1070,7 @@ var insertBookmarkMetadata = Task.async(function* (bookmarkItem, insertInfo) {
|
||||
}
|
||||
|
||||
try {
|
||||
newItem.tags = yield tagItem(bookmarkItem, insertInfo.tags);
|
||||
newItem.tags = tagItem(bookmarkItem, insertInfo.tags);
|
||||
} catch (ex) {
|
||||
BookmarkSyncLog.warn(`insertBookmarkMetadata: Error tagging item ${
|
||||
insertInfo.syncId}`, ex);
|
||||
@ -1295,7 +1295,7 @@ var updateBookmarkMetadata = Task.async(function* (oldBookmarkItem,
|
||||
let newItem = yield placesBookmarkToSyncBookmark(newBookmarkItem);
|
||||
|
||||
try {
|
||||
newItem.tags = yield tagItem(newBookmarkItem, updateInfo.tags);
|
||||
newItem.tags = tagItem(newBookmarkItem, updateInfo.tags);
|
||||
} catch (ex) {
|
||||
BookmarkSyncLog.warn(`updateBookmarkMetadata: Error tagging item ${
|
||||
updateInfo.syncId}`, ex);
|
||||
@ -1410,7 +1410,7 @@ var getAnno = Task.async(function* (guid, anno) {
|
||||
return rows.length ? rows[0].getResultByName("content") : null;
|
||||
});
|
||||
|
||||
var tagItem = Task.async(function(item, tags) {
|
||||
function tagItem(item, tags) {
|
||||
if (!item.url) {
|
||||
return [];
|
||||
}
|
||||
@ -1428,7 +1428,7 @@ var tagItem = Task.async(function(item, tags) {
|
||||
PlacesUtils.tagging.untagURI(dummyURI, null, SOURCE_SYNC);
|
||||
|
||||
return newTags;
|
||||
});
|
||||
}
|
||||
|
||||
// `PlacesUtils.bookmarks.update` checks if we've supplied enough properties,
|
||||
// but doesn't know about additional livemark properties. We check this to avoid
|
||||
|
@ -450,12 +450,12 @@ Enqueuer.prototype = {
|
||||
* and all promises passed to alsoWaitFor are no longer pending.
|
||||
*
|
||||
* @param aFunc
|
||||
* @see Task.spawn.
|
||||
* a function returning a promise.
|
||||
* @return a promise that resolves once aFunc is done running. The promise
|
||||
* "mirrors" the promise returned by aFunc.
|
||||
*/
|
||||
enqueue(aFunc) {
|
||||
let promise = this._promise.then(Task.async(aFunc));
|
||||
let promise = this._promise.then(aFunc);
|
||||
|
||||
// Propagate exceptions to the caller, but dismiss them internally.
|
||||
this._promise = promise.catch(console.error);
|
||||
|
@ -47,7 +47,7 @@ function waitForEvent(target, eventName) {
|
||||
|
||||
function runTests()
|
||||
{
|
||||
Task.async(function* () {
|
||||
Task.spawn(function* () {
|
||||
var popup = $("popup");
|
||||
popup.enableKeyboardNavigator(false);
|
||||
is(popup.getAttribute("ignorekeys"), "true", "keys disabled");
|
||||
@ -106,7 +106,7 @@ function runTests()
|
||||
yield popupHiddenPromise;
|
||||
|
||||
SimpleTest.finish();
|
||||
})();
|
||||
});
|
||||
}
|
||||
|
||||
function attrModified(event)
|
||||
|
@ -8,7 +8,6 @@ this.EXPORTED_SYMBOLS = ["AsyncPrefs"];
|
||||
|
||||
const {interfaces: Ci, utils: Cu, classes: Cc} = Components;
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
|
||||
const kInChildProcess = Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT;
|
||||
|
||||
@ -65,7 +64,7 @@ if (kInChildProcess) {
|
||||
let gMsgMap = new Map();
|
||||
|
||||
AsyncPrefs = {
|
||||
set: Task.async(function(pref, value) {
|
||||
set(pref, value) {
|
||||
let error = maybeReturnErrorForSet(pref, value);
|
||||
if (error) {
|
||||
return Promise.reject(error);
|
||||
@ -76,9 +75,9 @@ if (kInChildProcess) {
|
||||
gMsgMap.set(msgId, {resolve, reject});
|
||||
Services.cpmm.sendAsyncMessage("AsyncPrefs:SetPref", {pref, value, msgId});
|
||||
});
|
||||
}),
|
||||
},
|
||||
|
||||
reset: Task.async(function(pref) {
|
||||
reset(pref) {
|
||||
let error = maybeReturnErrorForReset(pref);
|
||||
if (error) {
|
||||
return Promise.reject(error);
|
||||
@ -89,7 +88,7 @@ if (kInChildProcess) {
|
||||
gMsgMap.set(msgId, {resolve, reject});
|
||||
Services.cpmm.sendAsyncMessage("AsyncPrefs:ResetPref", {pref, msgId});
|
||||
});
|
||||
}),
|
||||
},
|
||||
|
||||
receiveMessage(msg) {
|
||||
let promiseRef = gMsgMap.get(msg.data.msgId);
|
||||
@ -116,7 +115,7 @@ if (kInChildProcess) {
|
||||
string: "setCharPref",
|
||||
},
|
||||
|
||||
set: Task.async(function(pref, value) {
|
||||
set(pref, value) {
|
||||
let error = maybeReturnErrorForSet(pref, value);
|
||||
if (error) {
|
||||
return Promise.reject(error);
|
||||
@ -129,9 +128,9 @@ if (kInChildProcess) {
|
||||
Cu.reportError(ex);
|
||||
return Promise.reject(ex.message);
|
||||
}
|
||||
}),
|
||||
},
|
||||
|
||||
reset: Task.async(function(pref) {
|
||||
reset(pref) {
|
||||
let error = maybeReturnErrorForReset(pref);
|
||||
if (error) {
|
||||
return Promise.reject(error);
|
||||
@ -144,7 +143,7 @@ if (kInChildProcess) {
|
||||
Cu.reportError(ex);
|
||||
return Promise.reject(ex.message);
|
||||
}
|
||||
}),
|
||||
},
|
||||
|
||||
receiveMessage(msg) {
|
||||
if (msg.name == "AsyncPrefs:SetPref") {
|
||||
|
@ -337,37 +337,37 @@ ConnectionData.prototype = Object.freeze({
|
||||
// concurrently.
|
||||
let loggedDb = Object.create(parent, {
|
||||
execute: {
|
||||
value: Task.async(function*(sql, ...rest) {
|
||||
value: async (sql, ...rest) => {
|
||||
status.isPending = true;
|
||||
status.command = sql;
|
||||
try {
|
||||
return (yield this.execute(sql, ...rest));
|
||||
return (await this.execute(sql, ...rest));
|
||||
} finally {
|
||||
status.isPending = false;
|
||||
}
|
||||
}.bind(this))
|
||||
}
|
||||
},
|
||||
close: {
|
||||
value: Task.async(function*() {
|
||||
value: async () => {
|
||||
status.isPending = false;
|
||||
status.command = "<close>";
|
||||
try {
|
||||
return (yield this.close());
|
||||
return (await this.close());
|
||||
} finally {
|
||||
status.isPending = false;
|
||||
}
|
||||
}.bind(this))
|
||||
}
|
||||
},
|
||||
executeCached: {
|
||||
value: Task.async(function*(sql, ...rest) {
|
||||
value: async (sql, ...rest) => {
|
||||
status.isPending = false;
|
||||
status.command = sql;
|
||||
try {
|
||||
return (yield this.executeCached(sql, ...rest));
|
||||
return (await this.executeCached(sql, ...rest));
|
||||
} finally {
|
||||
status.isPending = false;
|
||||
}
|
||||
}.bind(this))
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user