mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-03 07:01:19 +00:00
Bug 1846343 - [remote] Do not emit network events for discarded browsing contexts r=webdriver-reviewers,whimboo
Depends on D187477 Differential Revision: https://phabricator.services.mozilla.com/D187478
This commit is contained in:
parent
3f9f4304ec
commit
1cecc01304
@ -447,6 +447,13 @@ class NetworkModule extends Module {
|
||||
timestamp,
|
||||
} = data;
|
||||
|
||||
const browsingContext = lazy.TabManager.getBrowsingContextById(contextId);
|
||||
if (!browsingContext) {
|
||||
// Do not emit events if the context id does not match any existing
|
||||
// browsing context.
|
||||
return;
|
||||
}
|
||||
|
||||
const protocolEventName = "network.beforeRequestSent";
|
||||
const isListening = this.messageHandler.eventsDispatcher.hasListener(
|
||||
protocolEventName,
|
||||
@ -476,7 +483,6 @@ class NetworkModule extends Module {
|
||||
initiator,
|
||||
});
|
||||
|
||||
const browsingContext = lazy.TabManager.getBrowsingContextById(contextId);
|
||||
this.emitEvent(
|
||||
protocolEventName,
|
||||
beforeRequestSentEvent,
|
||||
@ -511,6 +517,13 @@ class NetworkModule extends Module {
|
||||
timestamp,
|
||||
} = data;
|
||||
|
||||
const browsingContext = lazy.TabManager.getBrowsingContextById(contextId);
|
||||
if (!browsingContext) {
|
||||
// Do not emit events if the context id does not match any existing
|
||||
// browsing context.
|
||||
return;
|
||||
}
|
||||
|
||||
const protocolEventName =
|
||||
name === "response-started"
|
||||
? "network.responseStarted"
|
||||
@ -538,7 +551,6 @@ class NetworkModule extends Module {
|
||||
response: responseData,
|
||||
});
|
||||
|
||||
const browsingContext = lazy.TabManager.getBrowsingContextById(contextId);
|
||||
this.emitEvent(
|
||||
protocolEventName,
|
||||
responseEvent,
|
||||
|
Loading…
x
Reference in New Issue
Block a user