Ctrl+Click from home page focuses on new tab
Categories
(Firefox :: New Tab Page, defect, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr78 | --- | unaffected |
firefox81 | --- | unaffected |
firefox82 | --- | unaffected |
firefox83 | --- | verified |
People
(Reporter: sidvishnoi, Assigned: thecount)
References
(Regression)
Details
(Keywords: regression)
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0
Steps to reproduce:
- Ctrl+Click on "Top sites" from the default home page.
Actual results:
The newly opened tab got focused.
"When you open a link in a new tab, switch to it immediately" is disabled in about:preferences
Right click -> open in new tab did not focus on new tab.
mozregression directed me to bug 1599368.
Expected results:
New tab should not have gained focus on Ctrl+Click.
Reporter | ||
Updated•4 years ago
|
Reporter | ||
Comment 1•4 years ago
|
||
Attachment corrupt somehow. Uploaded demo to imgur: https://i.imgur.com/V7euzON.mp4
Assignee | ||
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Comment 2•4 years ago
|
||
@gijs Looks like we broke something in bug 1599368.
I've done some investigating, I think I know what's going on, and I think we have some options.
When we went from calling openLinkIn
to openTrustedLinkIn
we ended up hitting a code path that sets params.fromChrome to true: https://searchfox.org/mozilla-central/source/browser/base/content/utilityOverlay.js#349
It then calls openLinkIn
. Later on inside openLinkIn
we assume fromChrome means do not open in background: https://searchfox.org/mozilla-central/source/browser/base/content/utilityOverlay.js#585
I think we can either:
- Refactor
openTrustedLinkIn
to only usefromChrome
when it makes sense. Seems like it's an assumption that either, a trusted link is a chrome link, or an assumption that a chrome link should always be focused when opened. - Go back to calling
openLinkIn
and manually sendtriggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal()
, but I don't think this is ideal, because what if what we consider to be trusted changes in the future.
Comment 3•4 years ago
|
||
(In reply to Scott [:thecount] Downe from comment #2)
@gijs Looks like we broke something in bug 1599368.
I've done some investigating, I think I know what's going on, and I think we have some options.
When we went from calling
openLinkIn
toopenTrustedLinkIn
we ended up hitting a code path that sets params.fromChrome to true: https://searchfox.org/mozilla-central/source/browser/base/content/utilityOverlay.js#349
Bah, sorry for missing that.
It then calls
openLinkIn
. Later on insideopenLinkIn
we assume fromChrome means do not open in background: https://searchfox.org/mozilla-central/source/browser/base/content/utilityOverlay.js#585I think we can either:
- Refactor
openTrustedLinkIn
to only usefromChrome
when it makes sense. Seems like it's an assumption that either, a trusted link is a chrome link, or an assumption that a chrome link should always be focused when opened.
Yeah, it's the latter, but there are dozens of callsites.
We could probably change openUILinkIn
to only set fromChrome
if it's not already explicitly set to false, and then explicitly pass false
from the callsite in the new tab code?
- Go back to calling
openLinkIn
and manually sendtriggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal()
, but I don't think this is ideal, because what if what we consider to be trusted changes in the future.
I don't think that the concept of "trusted" is likely to change, so I don't think this is that bad an option. Either of these two works for me.
Whichever we pick, we should add a browser mochitest that checks that these links open correctly, so we don't break it in future. https://searchfox.org/mozilla-central/rev/f27594d62e7f1d57626889255ce6a3071d67209f/toolkit/content/tests/browser/browser_license_links.js might be a decent template for how to do something like that.
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 4•4 years ago
|
||
Pushed by sdowne@getpocket.com: https://hg.mozilla.org/integration/autoland/rev/d175746088d7 fixing ctrl+click newtab link clicks focus issue r=Gijs
Comment 6•4 years ago
|
||
bugherder |
Comment 7•4 years ago
|
||
Set release status flags based on info from the regressing bug 1599368
Comment 8•4 years ago
|
||
I have verified that the topsite opened using "Ctrl+Click" ("Cmd+click" for macOS) is NOT focused using Firefox Nightly 83.0a1 (Build ID: 20201002092536) on Windows 10 x64, macOS 10.15.6, and Ubuntu Linux 20.04 x64.
Updated•4 years ago
|
Description
•