Closed Bug 1640665 Opened 4 years ago Closed 4 years ago

Use `inBackground` parameter of duplicateTab in duplicateTabIn

Categories

(Firefox :: Tabbed Browser, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
Firefox 80
Tracking Status
firefox80 --- fixed

People

(Reporter: robwu, Assigned: aroraharsh010, Mentored)

References

Details

Attachments

(1 file)

When the patch for bug 1376088 lands, the duplicateTab method has a new inBackground option that defaults to true. Let's set that option to false (to set the duplicated tab as the active tab) instead of manually doing that at https://searchfox.org/mozilla-central/rev/501eb4718d73870892d28f31a99b46f4783efaa0/browser/base/content/browser.js#8542-8543

By doing so, the tab duplication logic of extension code and frontend code will behave identical, and also trigger the same kinds of events. Bugs and fixes for the one would automatically apply to the other.

There will be a slight difference in behavior: The inBackground option will only change the selected tab shortly after initializing the tab, whereas the current logic immediately switches to the newly duplicated tab, even before the restoration of its contents has started.

Hi, I would like to contribute to this. Could you help me get started on this?

Flags: needinfo?(rob)

To get started, you will need to have a copy of the source code, and install build dependencies. Since you only need to change frontend code (JavaScript) and no native code (e.g. C++, Rust, ...), you can get started more quickly by using artifact builds.

To get started, see https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
Documentation on artifact builds is at https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Artifact_builds

While you are waiting for the source code to be cloned, it would be good to get familiar with the code that you need to change. In my original report, I linked to the relevant code on Searchfox. If you prefer live debugging over reading code, then you can use the Browser Toolbox, open browser.js and set a breakpoint at the relevant line, and then interact with Firefox to trigger that breakpoint.

To trigger this code, right-click on a browser tab, and choose "Duplicate Tab". The first comment describes how the code should be changed (and still work).

Good luck, and feel free to ask more questions if needed.

Mentor: rob
Flags: needinfo?(rob)

I will get started on this.

Hi Rob,
Is this fixed yet? If not, maybe I could take this up.

Flags: needinfo?(rob)

(In reply to agentcoulsonphil3 from comment #3)

I will get started on this.

Are you still working on this? If so, please let us know where you are at.
If we don't get a reply by the end of the week, consider the bug to be up for grabs.

Flags: needinfo?(rob)

From what I understand from your link, the line gBrowser.selectedTab = newTab; manually switches our duplicated tab to active. I believe this line needs to be removed and the parameter of inBackground needs to passed as false in the SessionStore.duplicateTab() in the preceding line?

Flags: needinfo?(rob)

(In reply to Harsh from comment #6)

From what I understand from your link, the line gBrowser.selectedTab = newTab; manually switches our duplicated tab to active. I believe this line needs to be removed and the parameter of inBackground needs to passed as false in the SessionStore.duplicateTab() in the preceding line?

Yes, that's correct. Patches are welcome :)

Flags: needinfo?(rob)
Assignee: nobody → aroraharsh010
Status: NEW → ASSIGNED
Pushed by dluca@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d9e15f6cc350
Use `inBackground` parameter of duplicateTab in duplicateTabIn. r=robwu
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 80
Regressions: 1657992
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: