Use watcher context to filter out network events
Categories
(DevTools :: Netmonitor, task)
Tracking
(firefox97 fixed)
Tracking | Status | |
---|---|---|
firefox97 | --- | fixed |
People
(Reporter: ochameau, Assigned: ochameau)
References
Details
Attachments
(4 files)
For now, the various resource watchers on the server side are using a browserId
attribute to distinguish tab versus browser toolbox debugging.
But ideally, we should be using Watcher actor's context object in order to convey this information.
So we should pass the context object down to the matchRequest method:
https://searchfox.org/mozilla-central/rev/4ca2f73ae9346709d39de2c8fe33874e4203b9e6/devtools/server/actors/network-monitor/network-observer.js#79-90
Alongside to this, we should probably unify all network resource watchers to always use matchRequest
to filter network related platform events.
NetworkEventContentWatcher is using a distinct implementation over here:
https://searchfox.org/mozilla-central/rev/4ca2f73ae9346709d39de2c8fe33874e4203b9e6/devtools/server/actors/resources/network-events-content.js#83-91
And misses filtering over there:
https://searchfox.org/mozilla-central/source/devtools/server/actors/resources/network-events-content.js#116-128
Also, there is this code in NetworkEventActor, which is created by the previous class (NetworkEventContentWatcher):
https://searchfox.org/mozilla-central/rev/9028b0458cc1f432870d2996b186b0938dda734a/devtools/server/actors/network-monitor/network-event-actor.js#107-109
We pass down the resource class to access its browserId, which is a mapping to watcher's context's browserId.
It would be clearer and simplify if we were passing down the context down to this code.
By doing all that we ensure always using the context to filter out channels/requests.
This will then help bug 1569859 slightly change how we accept BrowsingContext.
We will no longer only accept browsingcontext by doing:
browsingContext.browserId == context.browserId
But we will also accept:
browsingContext.opener.browserId == context.browserId
.
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 1•3 years ago
|
||
This will be useful in next patch to know what is the overall debugged context.
We can finally know if that's the browser context/toolbox from almost any part of the server codebase!
Assignee | ||
Comment 2•3 years ago
|
||
This will help always use context to filter out resources.
Assignee | ||
Comment 3•3 years ago
|
||
This is more reliable check and it feels more common type of check
we already do elsewhere.
It also helps expose less convoluted objects to NetworkEventActor and so simplify it.
Assignee | ||
Comment 4•3 years ago
|
||
In prevision of a broader use of this existing "context" object,
I'm renaming it in order to make this important object clearer and more easily identifiable.
SessionContext object defines what we are debugging (everything, only one tab, an addon,...)
and so controls which platform data we should expose back to the client.
Comment 6•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/65845fd3f853
https://hg.mozilla.org/mozilla-central/rev/1af93ade7986
https://hg.mozilla.org/mozilla-central/rev/9bbaf0d2cbe1
https://hg.mozilla.org/mozilla-central/rev/4f4e935acf4c
Description
•