This repository was archived by the owner on Sep 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
Promises upgrade #8789
Copy link
Copy link
Closed
Labels
Description
Though we'll ultimately want to use a more full-featured promises implementation, both Q and Bluebird use a done
method with a different meaning than the one offered by jQuery. To make the transition easier, we can stick with es6 promises and choose a library with more features once we're ready to remove the deprecated wrapping.
Note that extensions can still use jQuery promises if they wish because extensions don't send promises into core code (as far as I know).
- Use the es6-promise shim until we've updated to a Chromium version that includes the native Promise object
- Augment or wrap promises so that they include
done
andfail
that issue deprecation warnings but otherwise behave like jQuery promises (returning the same promise). - Add unit test for Promise shim. Update tests in utils/Async to use new promises.
- Replace all instances of
new $.Deferred
and$.Deferred
with a use of standard promises - Test popular extensions to make sure they still work and display expected deprecation warnings
- Exceptions currently get sent to window.onerror and can be caught by the debugger. We need to ensure that the new solution doesn't just swallow them.
Note: after discussion we want to stick with standard promises and use utility functions rather than using extended promise objects as libraries like Bluebird give us.
Tasks
- Add es6-promise shim
- Add unit tests for Promise shim
- Augment promises (prototype) to include
done
,fail
andalways
- Update tests in
Async-tests
to use new promises. - Replace all instances of
new $.Deferred
with a use of standard promises inbrackets\src\
folder (exceptextensions
&thirdparty
) - Fix bugs in
brackets\src\
- Replace all instances of
new $.Deferred
with a use of standard promises inbrackets\test\
folder - Fix unit tests (some of which rely on synchronous promise resolution)
- Replace all instances of
new $.Deferred
with a use of standard promises inbrackets\src\extensions
folder - Test popular extensions
- Scrub all fail->catch handler conversions and make sure they allow the possibility where they get an unexpected exception as their argument, rather than a normal expected error code.
- When replacing fail with catch, look for a way to consistently handle the new case where an exception could happen
- Wrap promises coming from extensions for new behavior with deprecation warning as well
- Provide a utility function for
always