Closed Bug 1976416 Opened 6 months ago Closed 13 days ago

Add helper to assert and transform browsing and user contexts in emulation commands

Categories

(Remote Protocol :: WebDriver BiDi, task, P3)

task

Tracking

(firefox148 fixed)

RESOLVED FIXED
148 Branch
Tracking Status
firefox148 --- fixed

People

(Reporter: Sasha, Assigned: sameembaba, Mentored)

Details

(Whiteboard: [webdriver:m18][lang=js][webdriver:external])

Attachments

(1 file)

In the emulation commands such "setGeolocationOverride" and "setLocaleOverride" we repeat the following steps:

  • assert that at least one of the contexts or user contexts are provided (and not both);
  • for browsing contexts, check if it exists and top level, extract to set of navigables;
  • for user contexts, check if exists, get navigables and extract to set of internal user contexts.

We could create a helper (or multiple helpers) to avoid repetition.
There is a similar algorithm in "browsingContext.setViewport" command, with the only difference that there can be only one browsing context as an argument, but the rest is similar to emulation commands, so we could probably simplify it as well.

Mentor: aborovova
Priority: -- → P3
Whiteboard: [webdriver:backlog][lang=js]

Hello, I would like to work on this issue, can I get assigned to it?

(In reply to sabina from comment #1)

Hello, I would like to work on this issue, can I get assigned to it?

Sure, done. Let me know if you need more information :)

Assignee: nobody → sabina.zaripova
Status: NEW → ASSIGNED

Hi Sabina!
How is it going with the bug? Do you maybe need some help?
Let us know :)

Flags: needinfo?(sabina.zaripova)

Hello, sorry for disappearing, I was busy lately. I will work on this issue this week.

Flags: needinfo?(sabina.zaripova)

Hey, Sabina!
Just checking again if it's going fine with the bug :)

Flags: needinfo?(sabina.zaripova)

There is a similar algorithm in "browsingContext.setViewport" command, with the only difference that there can be only one browsing context as an argument, but the rest is similar to emulation commands, so we could probably simplify it as well.

Should helpers created for "setGeolocationOverride" and "setLocaleOverride" cases be applicable to "browsingContext.setViewport" as well?

Flags: needinfo?(sabina.zaripova)

(In reply to sabina from comment #6)

Should helpers created for "setGeolocationOverride" and "setLocaleOverride" cases be applicable to "browsingContext.setViewport" as well?

Ideally, yes :) But if it gets too complicated we can move this part to follow-up.

Hey @sabina,
do you still have time to work on the bug? If not, it's no problem, just let us know so we can reset the assignee.

Flags: needinfo?(sabina.zaripova)
Status: ASSIGNED → NEW
Assignee: sabina.zaripova → nobody

hey there! Can i work on this issue?

I’d be happy to take this issue if it’s available. I’ve been reviewing the description and understand the repeated logic in the emulation commands (setGeolocationOverride, setLocaleOverride). I’m setting up the build environment now

Flags: needinfo?(aborovova)

Hi Sameem, sure, go ahead! I assigned the bug to you. Please let me know if you have any questions.
Just a note that since the bug was created, we added more emulation commands that share the same assertion logic, and it would be great to update them as well.

Assignee: nobody → ssssameembaba
Status: NEW → ASSIGNED
Flags: needinfo?(sabina.zaripova)
Flags: needinfo?(aborovova)

Hi Sasha,

I’ve addressed the issues mentioned earlier and updated the patch accordingly. The refactor preserves existing behavior and validation. Please let me know if anything else needs adjustment.

Pushed by aborovova@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/14f37b0705c9 https://hg.mozilla.org/integration/autoland/rev/4528c71d847c Add helper to assert and transform browsing and user contexts in emulation commands. r=Sasha

Hi Sasha,

Thanks for guiding me through this first patch! I really enjoyed working on the WebDriver BiDi module and learning about how the emulation commands work.

Since I have my build environment set up and familiarized myself with the code structure, I would love to contribute more to this component.

Do you have any other "good first bugs" or backlog tasks in WebDriver BiDi (or related remote modules) that I could tackle next?

Status: ASSIGNED → RESOLVED
Closed: 13 days ago
Resolution: --- → FIXED
Target Milestone: --- → 148 Branch

Sameem thanks a lot! Great to see that we are now able to get rid of this massive code duplication.

Whiteboard: [webdriver:backlog][lang=js] → [webdriver:m18][lang=js][webdriver:external]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: