mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-09 21:00:42 +02:00
Most of this is fixing functions that in some cases return a value but then can also run to completion without returning anything. ESLint 2 catches this where previous versions didn't. Unless there was an obvious other choice I just made these functions return undefined at the end which is effectively what already happens. MozReview-Commit-ID: KHYdAkRvhVr --HG-- extra : rebase_source : 720cc9d864175248508146a7f4704b4bf3f02439 extra : histedit_source : 6cc0ecbf21a571e1a41d517b67512a3452fac19a
33 lines
834 B
JavaScript
33 lines
834 B
JavaScript
"use strict";
|
|
|
|
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
|
|
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
|
"resource://gre/modules/Promise.jsm");
|
|
|
|
/**
|
|
* A wrapper for the findbar's method "close", which is not synchronous
|
|
* because of animation.
|
|
*/
|
|
function closeFindbarAndWait(findbar) {
|
|
return new Promise((resolve) => {
|
|
if (findbar.hidden) {
|
|
resolve();
|
|
return;
|
|
}
|
|
findbar.addEventListener("transitionend", function cont(aEvent) {
|
|
if (aEvent.propertyName != "visibility") {
|
|
return;
|
|
}
|
|
findbar.removeEventListener("transitionend", cont);
|
|
resolve();
|
|
});
|
|
findbar.close();
|
|
});
|
|
}
|
|
|
|
function pushPrefs(...aPrefs) {
|
|
let deferred = Promise.defer();
|
|
SpecialPowers.pushPrefEnv({"set": aPrefs}, deferred.resolve);
|
|
return deferred.promise;
|
|
}
|