New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 700124 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug-Regression



Sign in to add a comment

Iframe causes new tab to lose focus

Reported by galambal...@gmail.com, Mar 9 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/602.3.12 (KHTML, like Gecko) Version/10.0.2 Safari/602.3.12

Steps to reproduce the problem:
General case:
1. User is doing something on new tab page
2. It triggers an iframe to be loaded
3. New Tab loses focus

Specific example:
1. Try typing in a textbox
2. It triggers an iframe load by assigning to its 'src' property
3. New Tab loses focus, address bar becomes focused. 
User is still trying to type and it's all messed up

What is the expected behavior?

What went wrong?
Loading an iframe (background or foreground) shouldn't cause the New Tab to lose focus.

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 56.0.2924.87 (64-bit)  Channel: stable
OS Version: OS X 10.12.2
Flash Version: 

This used to work correctly I believe.

 
NewTabProblem.zip
976 bytes Download
Labels: Needs-Milestone
Cc: sureshkumari@chromium.org
Labels: Needs-Feedback
Unable to reproduce the issue on Mac-10.12.2, Windows-7 and Linux Ubuntu-14.04 using Chrome stable version 57.0.2987.98 & canary 59.0.3037.0 and reported version 56.0.2924.87 with the steps mentioned in comment#0.
galambalazs@ Please find the attached screen cast and let us know if anything missed here to reproduce the issue.

Thanks..
700124.mov
3.3 MB Download
I just loaded the attached extension again on an empty profile and can definitely reproduce on both:

Version 57.0.2987.98 (64-bit)
Version 59.0.3037.0 (Official Build) canary (64-bit)

Mac-10.12.2

(same on windows)

Can this be because of the 64 bit build being different?



Project Member

Comment 4 by sheriffbot@chromium.org, Mar 10 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "sureshkumari@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
I just saw that you used 64 bit in the video too (just not mentioned in the comment).

Here is my screencast.

It has been reported by other users so it's definitely not just on my machine. And I can reproduce 100% of the time.

FocusBug.mov
8.8 MB Download
I can see why you couldn't reproduce!


You opened index.html as a file:///....


This is supposed to be loaded as an Extension (that's why I called it New Tab bug)

chrome://extensions/ & Load Unpacked Extension

Then you will see the focusing bug.
Cc: brajkumar@chromium.org
Components: Platform>Extensions Blink>HTML>IFrame
Labels: -Type-Bug hasbisect-per-revision M-59 OS-Linux OS-Windows Type-Bug-Regression
Owner: nasko@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce on Windows-10, Ubuntu 14.04 and Mac OS 10.12 using chrome stable M57-57.0.2987.98.

Bisect Information:
=====================
Good build: 55.0.2841.0
Bad Build : 55.0.2843.0

Change Log URL: 
https://chromium.googlesource.com/chromium/src/+log/5d6411a1a10652b1a3d9ced8d744f7e427918805..d8f0aefde00132b06bd97cb17555f2ec89a0c203

From the above change log suspecting below change
Review URL: https://codereview.chromium.org/2285883002

nasko@ - Could you please check whether this is caused with respect to your change, if not please help us in assigning it to the right owner.

Thanks!

Comment 8 by nasko@chromium.org, Mar 14 2017

Cc: creis@chromium.org nasko@chromium.org
Owner: alex...@chromium.org
Yes, this does indeed look like behavior difference with Isolate Extensions. Assigning to alexmos@ for further follow up.

I think the root cause is that during commit of a document, we always call WebContentsImpl::FocusLocationBarByDefault(), which returns true for the new tab page, then focus the omnibox if the result was true. It is not conditional on whether it is a subframe or not, which is why it will always focus the omnibox. 

If my analysis is correct, it might be useful to restrict the focus behavior of the omnibox to only the commit of the main frame, not for subframes.

Comment 9 by creis@chromium.org, Mar 14 2017

Components: UI>Browser>NewTabPage Internals>Sandbox>SiteIsolation
Nice find.  In theory that could be a bug in the NTP even without extensions or out-of-process iframes, right?  It would be tough to hit in practice, but if the most visited tiles were slow to commit, you could tab around the NTP (shifting keyboard focus) and then have focus jump to the omnibox when the tile iframes commit.

Comment 10 by creis@chromium.org, Mar 14 2017

Nevermind about affecting the old NTP-- Nasko points out that the FocusLocationBarByDefault call only happens on cross-process navigations, so it is a new issue with out-of-process iframes on the NTP.
Status: Started (was: Assigned)
I've confirmed that not calling FocusLocationBarByDefault for subframe commits fixes this.  The fix seems to be easy; I'll now work on a test for this.
Summary: Iframe causes new tab to lose focus (was: Iframe causes new tab to load focus)
Project Member

Comment 13 by bugdroid1@chromium.org, Mar 15 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5e8b5e6aebcb564897e311ae4f4397eed3555457

commit 5e8b5e6aebcb564897e311ae4f4397eed3555457
Author: alexmos <alexmos@chromium.org>
Date: Wed Mar 15 21:52:47 2017

Don't focus the omnibox when a subframe navigates on NTP.

This fixes a bug where an NTP replacement page from an extension was
losing focus to the omnibox when a subframe on that page committed a
navigation.  So if the user was typing into an <input> on the NTP
replacement page while a subframe navigated, the focus was
disruptively shifted to the omnibox in the middle of typing.

This matters only in OOPIF modes, as focusing of the omnibox was done
in RenderFrameHostManager::CommitPending, which is only used for
cross-process commits.

BUG= 700124 
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2748103005
Cr-Commit-Position: refs/heads/master@{#457222}

[modify] https://crrev.com/5e8b5e6aebcb564897e311ae4f4397eed3555457/chrome/browser/extensions/extension_override_apitest.cc
[modify] https://crrev.com/5e8b5e6aebcb564897e311ae4f4397eed3555457/content/browser/frame_host/render_frame_host_manager.cc

Comment 14 by creis@chromium.org, Mar 15 2017

Thanks for the fix, Alex!  Do you think this is a safe thing to merge to M58?  (I imagine it's not severe enough to go to M57.)
#14: I think so, as the fix is very short and straightforward.  I'll request a merge if things look good in tomorrow's canary.

Comment 16 by fi...@chromium.org, Mar 16 2017

Labels: zine-triaged
Labels: Merge-Request-58
Just verified that this is fixed on Win canary 59.0.3044.0, which has my fix from r457222.  Requesting merge to M58 given that the fix is low-risk.
Project Member

Comment 18 by sheriffbot@chromium.org, Mar 17 2017

Labels: -Merge-Request-58 Hotlist-Merge-Approved Merge-Approved-58
Your change meets the bar and is auto-approved for M58. Please go ahead and merge the CL to branch 3029 manually. Please contact milestone owner if you have questions.
Owners: amineer@(Android), cmasso@(iOS), bhthompson@(ChromeOS), govind@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 19 by bugdroid1@chromium.org, Mar 17 2017

Labels: -merge-approved-58 merge-merged-3029
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ac6993fe1faea8121d6584815eaae580921bcbc7

commit ac6993fe1faea8121d6584815eaae580921bcbc7
Author: Alex Moshchuk <alexmos@chromium.org>
Date: Fri Mar 17 18:14:30 2017

Don't focus the omnibox when a subframe navigates on NTP (Merge to M58)

This fixes a bug where an NTP replacement page from an extension was
losing focus to the omnibox when a subframe on that page committed a
navigation.  So if the user was typing into an <input> on the NTP
replacement page while a subframe navigated, the focus was
disruptively shifted to the omnibox in the middle of typing.

This matters only in OOPIF modes, as focusing of the omnibox was done
in RenderFrameHostManager::CommitPending, which is only used for
cross-process commits.

BUG= 700124 
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2748103005
Cr-Commit-Position: refs/heads/master@{#457222}
(cherry picked from commit 5e8b5e6aebcb564897e311ae4f4397eed3555457)

Review-Url: https://codereview.chromium.org/2754363002 .
Cr-Commit-Position: refs/branch-heads/3029@{#270}
Cr-Branched-From: 939b32ee5ba05c396eef3fd992822fcca9a2e262-refs/heads/master@{#454471}

[modify] https://crrev.com/ac6993fe1faea8121d6584815eaae580921bcbc7/chrome/browser/extensions/extension_override_apitest.cc
[modify] https://crrev.com/ac6993fe1faea8121d6584815eaae580921bcbc7/content/browser/frame_host/render_frame_host_manager.cc

Status: Fixed (was: Started)
Labels: TE-Verified-M58 TE-Verified-58.0.3029.33
Verified the fix on Mac 10.12.3, Win-10 and Ubuntu 14.04 using Chrome beta version #58.0.3029.33 as per the comment #0 and #6.

Observed that loading an iframe did not cause the New Tab to lose focus. Hence, the fix is working as expected.

Attaching the screencast for reference

Adding the verified labels.

Thanks...!!
700124.mp4
1006 KB View Download
Chrome team rules.
Thanks for the quick turnaround time.

- Blaze

Sign in to add a comment