зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1889417 - On errors, reject the document.l10n.ready promise in tests. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D206587
This commit is contained in:
Родитель
1a34259635
Коммит
84dc029bb0
|
@ -93,8 +93,15 @@ class L10nReadyHandler final : public PromiseNativeHandler {
|
|||
* rejection" warning, which is noisy and not-actionable.
|
||||
*
|
||||
* So instead, we just resolve and report errors.
|
||||
*
|
||||
* However, in automated tests we do reject so that errors with missing
|
||||
* messages and resources can be caught.
|
||||
*/
|
||||
mPromise->MaybeResolveWithUndefined();
|
||||
if (xpc::IsInAutomation()) {
|
||||
mPromise->MaybeRejectWithClone(aCx, aValue);
|
||||
} else {
|
||||
mPromise->MaybeResolveWithUndefined();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -12,12 +12,17 @@
|
|||
|
||||
document.addEventListener("DOMContentLoaded", async function() {
|
||||
/**
|
||||
* Even when we fail to localize all elements, we will
|
||||
* still resolve the `ready` promise to communicate that
|
||||
* Outside of tests, even when we fail to localize all elements,
|
||||
* we will still resolve the `ready` promise to communicate that
|
||||
* the initial translation phase is now completed.
|
||||
*
|
||||
* In tests, the promise will be rejected to allow errors to be caught.
|
||||
*/
|
||||
document.l10n.ready.then(() => {
|
||||
is(1, 1, "the ready should resolve");
|
||||
is(1, 2, "the ready should not resolve");
|
||||
SimpleTest.finish();
|
||||
}, (_err) => {
|
||||
is(1, 1, "the ready should reject");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче