Bug 1819570 - P3 using nsILoadInfo.WorkerAssociatedBrowsingContext for netmonitor. r=jdescottes,devtools-reviewers

After PFetch is enabled, fetch() call in workers will not create a channel in the content process anymore.
Although netmonitor also watches the channels in the parent process, the created channel still loses the BrowsingContext information for netmonitor to connect the network event and the channel.

Depends on D174441

Differential Revision: https://phabricator.services.mozilla.com/D174442
This commit is contained in:
Eden Chuang 2023-05-05 15:24:09 +00:00
parent da9145b668
commit c800899fd3

View File

@ -263,6 +263,13 @@ export var NetworkHelper = {
* @returns nsILoadContext or null
*/
getRequestLoadContext(request) {
try {
if (request.loadInfo.workerAssociatedBrowsingContext) {
return request.loadInfo.workerAssociatedBrowsingContext;
}
} catch (ex) {
// Ignore.
}
try {
return request.notificationCallbacks.getInterface(Ci.nsILoadContext);
} catch (ex) {