Closed
Bug 1879363
Opened 1 year ago
Closed 1 year ago
browsingContext module event subscription is inconsistent
Categories
(Remote Protocol :: WebDriver BiDi, task, P3)
Remote Protocol
WebDriver BiDi
Tracking
(firefox124 fixed)
RESOLVED
FIXED
124 Branch
| Tracking | Status | |
|---|---|---|
| firefox124 | --- | fixed |
People
(Reporter: jdescottes, Assigned: jdescottes)
Details
(Whiteboard: [webdriver:m10])
Attachments
(1 file)
After adding several events to the browsingContext module, the current code looks a bit inconsistent:
#unsubscribeEvent(event) {
switch (event) {
case "browsingContext.contextCreated":
case "browsingContext.contextDestroyed": {
this.#contextListener.stopListening();
this.#subscribedEvents.delete(event);
break;
}
case "browsingContext.fragmentNavigated":
case "browsingContext.navigationStarted": {
this.#stopListeningToNavigationEvent();
this.#subscribedEvents.delete(event);
break;
}
case "browsingContext.userPromptClosed":
case "browsingContext.userPromptOpened": {
this.#stopListeningToPromptEvent(event);
break;
}
}
}
Each block uses a different pattern for no strong reason, also stopListeningToNavigationEvent is supposed to take an "event" parameter, but here we call it without any parameter.
The contextCreated/contextDestroyed block is a bit worrying because it makes you think we will stop the listener if we unsubscribe from just one of the 2 events. It actually works because applySessionData ALWAYS calls #subscribeEvent for all events. But that means if you do something like:
- subscribe([contextCreated, contextDestroyed])
- unsubscribe([contextDestroyed])
The unsubscribe will stop the listener and start it immediately afterwards. We should rather reapply the same pattern as for the other events to avoid adding/removing observers unnecessarily.
| Assignee | ||
Comment 1•1 year ago
|
||
Updated•1 year ago
|
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e74d1619128b
[wdspec] Use consistent pattern for all event subsriptions in browsingContext module r=webdriver-reviewers,Sasha
| Assignee | ||
Updated•1 year ago
|
Points: --- → ?
Priority: -- → P3
| Assignee | ||
Updated•1 year ago
|
Whiteboard: [webdriver:m10]
Comment 3•1 year ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
status-firefox124:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 124 Branch
Updated•1 year ago
|
Points: ? → 1
You need to log in
before you can comment on or make changes to this bug.
Description
•