Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Promises upgrade #8789

@pthiess

Description

@pthiess

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 and fail 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 and always
  • Update tests in Async-tests to use new promises.
  • Replace all instances of new $.Deferred with a use of standard promises in brackets\src\ folder (except extensions & thirdparty)
  • Fix bugs in brackets\src\
  • Replace all instances of new $.Deferred with a use of standard promises in brackets\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 in brackets\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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions