Open Bug 1704361 Opened 4 years ago Updated 4 years ago

Ensure calling baseFrontClassDestroy before custom Front::destroy

Categories

(DevTools :: Framework, task, P3)

task

Tracking

(Not tracked)

People

(Reporter: jdescottes, Unassigned)

References

Details

Attachments

(1 file)

The destroy method of the base Front class is often overloaded. Sometimes it's even overloaded with an async method:

destroy: async function() {
  await someAsyncMethod();
  super.destroy();
}

With this kind of pattern, the parent's destroy is not called synchronously. There are some critical bits in Front::destroy that should run as soon as possible however. They have been extracted to a baseFrontClassDestroy which can safely be called early.

However we are still randomly patching the codebase to call it whenever a problem arises, eg https://phabricator.services.mozilla.com/D108792

      targetFront.baseFrontClassDestroy();
      targetFront.destroy();

This kind of code can be hard to understand as it requires some knowledge about typical destroy issues. It would be nice if this was handled on the framework level.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: