Open Bug 1655439 Opened 4 years ago Updated 4 years ago

Destroy ServiceWorker targets only when the SW is destroyed and not on each navigation

Categories

(DevTools :: Framework, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: ochameau, Unassigned)

References

(Blocks 1 open bug)

Details

Bug 1641796 implemented ServiceWorker target support in such a way, where we fake a destroy and a creation event for SW targets on navigation.

Out of the three options described by Julian over here:
https://phabricator.services.mozilla.com/D77425#2416452
Solution A was implemented, as that did not required to do any UX change, nor change anything in Debugger frontend codebase.

But this:

  • introduces confusion with this fake events (see bug 1633727 and this patch)
  • prevents debugging SW setup/teardown. You have to fallback on using about:debugging to inspect them early or late

The goal of this bug would be to implement Solution C, where we create targets for all SW matching current's page's origin. But the targets only get destroyed when the SW is really destroyed. It means that we can start seeing SW related to previous page's origins. And SW targets will typically stay visible across reload.
This would require a significant work in the Debugger frontend in order to avoid removing SW targets from the UI and only remove them when the TargetList reports them as destroyed.

Blocks: 1651522

Some info if you want to test this: the target-list supports this behavior via the destroyServiceWorkersOnNavigation flag, which is set by the debugger at https://searchfox.org/mozilla-central/rev/cf561cece0ca9aeaf0202e68699836d957d0c670/devtools/client/debugger/src/client/firefox.js#27

You can switch the flag to false to check the impact on the debugger (which currently forgets all sources on navigation, and therefore loses the sw ones).

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