Open Bug 1657281 Opened 4 years ago Updated 4 years ago

Apply resource transformers during the resourceUpdated and resourceDestoyed phases

Categories

(DevTools :: Framework, task, P3)

task

Tracking

(Not tracked)

People

(Reporter: jdescottes, Unassigned)

References

Details

Follow up to a discussion in https://phabricator.services.mozilla.com/D85879#inline-489568

Currently, we apply "transformers" to some resource types when a resource is first retrieved. Example of transformer: https://searchfox.org/mozilla-central/source/devtools/shared/resources/transformers/console-messages.js

The transformers are applied by the resource-watcher, in _onResourceAvailable: https://searchfox.org/mozilla-central/rev/a315a1a0f09550e23e4590a77e74f36543315da3/devtools/shared/resources/resource-watcher.js#285-292

We could also apply transformers when a resource is updated or destroyed.

For updates, resource updates are supposed to update the cache (Bug 1657153), so it makes sense to keep the resources consistent between available and update.

For destroy it is less clear. I initially added it because of my work on the root node resource (Bug 1635461). I used transformers to help with backward compatibility, and in theory I need this to run also for destroyed resources. But if we had resource ids, I think we could just emit the resource from the cache instead? It depends if we expect the "destroyed" resource to also have new information compared to the cached one, or if it's just a signal that the resource is gone.

If we add transformers to the update/destroyed steps, some of the questions to answer are:

  • should we reuse the same transformers as for the available step
  • if we use the same transformers, should we pass a flag to indicate if we are in available/update/destroyed step
You need to log in before you can comment on or make changes to this bug.