Closed
Bug 1710674
Opened 3 years ago
Closed 3 years ago
target-mixin resource cache mechanism is misbehaving
Categories
(DevTools :: Framework, defect)
DevTools
Framework
Tracking
(Fission Milestone:M7a, firefox90 fixed)
Tracking | Status | |
---|---|---|
firefox90 | --- | fixed |
People
(Reporter: nchevobbe, Assigned: nchevobbe)
References
Details
(Whiteboard: dt-fission-m3-mvp)
Attachments
(1 file)
While investigating test failures for https://phabricator.services.mozilla.com/D78862 , I discovered a couple things that were wrong with the target-mixin
resource cache:
- in https://searchfox.org/mozilla-central/source/devtools/client/fronts/targets/target-mixin.js#75 , we are not removing the listeners we set before, as we're creating new functions when binding, not retrieving the one we created in the constructor
- even if we'd remove it properly, we're only entering the if block if some resources were put in the cache. It could happen that it's not the case, and that would cause unwanted behavior later on.
Here's a scenario we can have:
- a target is created, which sets up the
resource-available-form
event listener intarget-mixin
targetFront.on("resource-available-form", ...)
is then called from theresourceCommand
- since there were no existing resources, the event listeners is not removed
- later, some resources are sent, and are put in the target-mixin cache
resourceCommand.unwatching
is called, and thenresourceCommand.watch
again- this causes another
targetFront.on("resource-available-form", ...)
- now we do have resources in the
target-mixin
cache, which means we're removing the listener fromtarget-mixin
, but also that we are callingresourceCommand.onResourceAvailabl
e with the resources that were in the cache
Assignee | ||
Comment 1•3 years ago
|
||
The event listeners that were set in the constructor were not
actually removed in the on
method, as we weren't using the
proper function reference.
Furthermore, the event listeners were removed only if some
resources were put in the cache, which could lead to some
buggy behavior when watching/unwatching multiple times.
Depends on D114926
Updated•3 years ago
|
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Assignee | ||
Updated•3 years ago
|
Whiteboard: dt-fission-m3-mvp
Updated•3 years ago
|
Fission Milestone: --- → M7a
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bece73e88772 [devtools] Fix target-mixin resource cache mechanism. r=ochameau,bomsy.
Comment 3•3 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
status-firefox90:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 90 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•