WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
UNCONFIRMED
61167
Middle clicking a named target sets a focus to a previously opened page
https://bugs.webkit.org/show_bug.cgi?id=61167
Summary
Middle clicking a named target sets a focus to a previously opened page
Shinya Kawanaka
Reported
2011-05-19 21:17:15 PDT
This bug can be reproduced with the following way. (1) open the attached file. (2) Middle click the named anchor to open a document (the document is opened in a background tab.) (3) show the opened document. (4) show the original document and middle click the named anchor again. (5) the document opened in (2) is foreground now.
Attachments
HTML file containing named target.
(144 bytes, text/html)
2011-05-19 21:19 PDT
,
Shinya Kawanaka
no flags
Details
Another file.
(128 bytes, text/html)
2011-05-20 00:38 PDT
,
Shinya Kawanaka
no flags
Details
patch to fix the problem
(5.47 KB, patch)
2011-05-20 00:47 PDT
,
Shinya Kawanaka
no flags
Details
Formatted Diff
Diff
Patch
(7.45 KB, patch)
2011-08-01 01:47 PDT
,
Shinya Kawanaka
no flags
Details
Formatted Diff
Diff
Patch
(12.38 KB, patch)
2011-08-04 18:22 PDT
,
Shinya Kawanaka
no flags
Details
Formatted Diff
Diff
Patch
(9.64 KB, patch)
2011-08-08 00:44 PDT
,
Shinya Kawanaka
no flags
Details
Formatted Diff
Diff
Patch
(9.87 KB, patch)
2011-08-08 01:39 PDT
,
Shinya Kawanaka
no flags
Details
Formatted Diff
Diff
Patch
(8.17 KB, patch)
2011-08-30 01:07 PDT
,
Shinya Kawanaka
eric
: review-
webkit.review.bot
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Shinya Kawanaka
Comment 1
2011-05-19 21:19:04 PDT
Created
attachment 94168
[details]
HTML file containing named target.
Alexey Proskuryakov
Comment 2
2011-05-19 23:47:59 PDT
I cannot reproduce this in Safari 5.0.5 on Mac OS X . What browser have you been testing with?
Shinya Kawanaka
Comment 3
2011-05-20 00:03:12 PDT
(In reply to
comment #2
)
> I cannot reproduce this in Safari 5.0.5 on Mac OS X . What browser have you been testing with?
I have tested in Safari 5.0.4 on Mac OS X (Snow leopard). Let me have time to check it in Safari 5.0.5 now.
Shinya Kawanaka
Comment 4
2011-05-20 00:38:06 PDT
Created
attachment 94182
[details]
Another file.
Shinya Kawanaka
Comment 5
2011-05-20 00:41:36 PDT
The newly attached file can reproduce it. (When middle clicking, 404 is displayed but please ignore 404.) Since the difference is the domain, when opening the same domain file this bug may occur.
Shinya Kawanaka
Comment 6
2011-05-20 00:42:27 PDT
(In reply to
comment #5
)
> The newly attached file can reproduce it. (When middle clicking, 404 is displayed but please ignore 404.) > > Since the difference is the domain, when opening the same domain file this bug may occur.
This is confirmed in Safari 5.0.5.
Shinya Kawanaka
Comment 7
2011-05-20 00:47:35 PDT
Created
attachment 94183
[details]
patch to fix the problem I'd like to write a test, but I have not written it well, so I upload only this patch for now.
Dominic Cooney
Comment 8
2011-05-20 01:06:23 PDT
Comment on
attachment 94183
[details]
patch to fix the problem View in context:
https://bugs.webkit.org/attachment.cgi?id=94183&action=review
> Source/WebCore/loader/FrameLoader.cpp:1379 > + && !openedBackgroundTab() && !targetFrame->loader()->openedBackgroundTab()) {
Why do you need to test whether this frame *and* the target frame haven't opened a background tab? Can't the canonical "background"-ness be stored in one place?
> Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp:853 > + m_webFrame->frame()->loader()->setOpenedBackgroundTab(true);
This should be indented two more spaces.
> Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp:971 > + if (navigationPolicy == WebNavigationPolicyNewBackgroundTab)
Why does this need to happen in two places?
> Source/WebKit/chromium/src/FrameLoaderClientImpl.h:253 > + bool m_openedBackgroundTab;
Who uses this one?
Shinya Kawanaka
Comment 9
2011-05-20 03:16:00 PDT
(In reply to
comment #8
)
> (From update of
attachment 94183
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=94183&action=review
> > > Source/WebCore/loader/FrameLoader.cpp:1379 > > + && !openedBackgroundTab() && !targetFrame->loader()->openedBackgroundTab()) { > > Why do you need to test whether this frame *and* the target frame haven't opened a background tab? Can't the canonical "background"-ness be stored in one place?
Usually the FrameLoader of the source Frame opens a new tab when middle click. however, when there is a tab having target name already, the FrameLoader of that tab opens a new tab. I wanted to unify it, but it became very messy.
> > Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp:971 > > + if (navigationPolicy == WebNavigationPolicyNewBackgroundTab) > > Why does this need to happen in two places?
Because creating new Tab and changing Tab content are different method.
> > > Source/WebKit/chromium/src/FrameLoaderClientImpl.h:253 > > + bool m_openedBackgroundTab; > > Who uses this one?
Sorry, this is my mistake.
Alexey Proskuryakov
Comment 10
2011-05-20 08:44:50 PDT
> The newly attached file can reproduce it. (When middle clicking, 404 is displayed but please ignore 404.)
I still cannot reproduce this - perhaps because I don't have a middle mouse button, and tested Cmd-clicking. Weird. Please be sure to mark the patch for review (review? flag) when it's ready, so that it doesn't get overlooked.
Shinya Kawanaka
Comment 11
2011-05-29 23:09:19 PDT
Ah, (In reply to
comment #10
)
> I still cannot reproduce this - perhaps because I don't have a middle mouse button, and tested Cmd-clicking. Weird.
I could reproduce it. You should display the opened file once ((3) is so). Without this step, Safari will work as expected.
> Please be sure to mark the patch for review (review? flag) when it's ready, so that it doesn't get overlooked.
I would like to have a test, but I don't know how to do it...
Matt Hickford
Comment 12
2011-07-26 09:36:53 PDT
I observe the bug in both of Kawanaka's examples in Google Chrome 12 but not in Safari 5.1 (Windows). Here are related bugs in the Chrome bug tracker
http://code.google.com/p/chromium/issues/detail?id=62319
http://code.google.com/p/chromium/issues/detail?id=84514
Shinya Kawanaka
Comment 13
2011-07-31 19:50:17 PDT
Hi, I confirmed that my example still works in Lion's Safari in another situation. 1) Open Another file. (attached one) 2) click the link (this will create another window, and NotFound page is displayed.) 3) back to the (1) page 4) the Cmd+click The last Cmd+click should open a tab in a background, however this focuses the window created in (2). (In reply to
comment #12
)
> I observe the bug in both of Kawanaka's examples in Google Chrome 12 but not in Safari 5.1 (Windows). > > Here are related bugs in the Chrome bug tracker
http://code.google.com/p/chromium/issues/detail?id=62319
http://code.google.com/p/chromium/issues/detail?id=84514
Shinya Kawanaka
Comment 14
2011-08-01 01:46:29 PDT
I made this issue chromium-specific. The Safari's problem is moved to
https://bugs.webkit.org/show_bug.cgi?id=65454
Shinya Kawanaka
Comment 15
2011-08-01 01:47:46 PDT
Created
attachment 102492
[details]
Patch
Hajime Morrita
Comment 16
2011-08-02 21:50:56 PDT
Comment on
attachment 102492
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=102492&action=review
> Source/WebCore/loader/FrameLoader.h:431 > + bool m_openedBackgroundTab;
How about to mirror navigation policy enum here instead of using enum? See Source/WebKit/chromium/src/AssertMatchingEnums.cpp to see similar patterns.
> Source/WebKit/chromium/src/FrameLoaderClientImpl.h:255 > + bool m_openedBackgroundTab;
It looks we don't need this.
Shinya Kawanaka
Comment 17
2011-08-04 18:22:53 PDT
Created
attachment 103016
[details]
Patch
Hajime Morrita
Comment 18
2011-08-05 02:27:24 PDT
Comment on
attachment 103016
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=103016&action=review
> Source/WebCore/ChangeLog:1 > +2011-08-04 Shinya Kawanaka <
shinyak@google.com
>
You should add NavigationPolicy.h to build configurations. For example WebCore.gypi for Chromium.
> Source/WebCore/loader/NavigationPolicy.h:1 > +/*
Why not use FrameLoaderTypes.h ? And I noticed it might be possible to extend PolicyAction to support this. But I'm not sure.
> Source/WebKit/chromium/public/WebNavigationPolicy.h:37 > + WebNavigationPolicyInvalid = -1,
Why -1?
Shinya Kawanaka
Comment 19
2011-08-08 00:44:56 PDT
Created
attachment 103215
[details]
Patch
WebKit Review Bot
Comment 20
2011-08-08 01:17:17 PDT
Comment on
attachment 103215
[details]
Patch
Attachment 103215
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/9215177
Shinya Kawanaka
Comment 21
2011-08-08 01:39:39 PDT
Created
attachment 103222
[details]
Patch
Shinya Kawanaka
Comment 22
2011-08-24 02:15:44 PDT
I often encounter this bug and every time I encounter this bug I am disappointed that this patch has not been reviewed yet... Could anyone review this? (In reply to
comment #21
)
> Created an attachment (id=103222) [details] > Patch
Alexey Proskuryakov
Comment 23
2011-08-24 08:44:05 PDT
The code changes are all cross platform, removing [Chromium] from title. How is this bug related to
bug 41951
and
bug 28137
? The regression test is a manual one. Can you simulate the click with EventSender?
Adam Barth
Comment 24
2011-08-24 10:12:34 PDT
Comment on
attachment 103222
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=103222&action=review
> Source/WebCore/loader/FrameLoader.cpp:198 > + , m_navigationPolicy(NavigationPolicyCurrentTab)
Why is this a property of the loader and not of the load itself?
> Source/WebCore/loader/FrameLoader.cpp:1173 > + m_navigationPolicy = NavigationPolicyCurrentTab;
What about all the other APIs for triggering navigations. As you've written the patch, it seems like they're re-use whatever value m_navigationPolicy happens to be set to.
Shinya Kawanaka
Comment 25
2011-08-24 22:58:05 PDT
(In reply to
comment #23
)
> The code changes are all cross platform, removing [Chromium] from title. > > How is this bug related to
bug 41951
and
bug 28137
?
I don't think this bug is related to these. This bug is to remove wrong focus() call when a new tab should be opened in background.
> > The regression test is a manual one. Can you simulate the click with EventSender?
Could you tell me how to check which tab is focused...? This problems includes several tabs, so I don't know how to do that.
Alexey Proskuryakov
Comment 26
2011-08-24 23:09:51 PDT
> Could you tell me how to check which tab is focused...?
The patch is in WebCore, so it should be affecting something other than just browser behavior. WebCore doesn't even know about tabs.
Adam Barth
Comment 27
2011-08-25 00:47:29 PDT
Comment on
attachment 103222
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=103222&action=review
> Source/WebCore/loader/FrameLoaderTypes.h:76 > + NavigationPolicyCurrentTab, > + NavigationPolicyNewBackgroundTab, > + NavigationPolicyNewForegroundTab,
I'm still not 100% clear on the problem you're trying to solve, but Alexey is correct that the notion of a tab is too specific for WebCore. Generally, the concept of a tab in the browser corresponds to a Page in WebCore. I'm not sure WebCore has any concept of current / background / foreground Pages, however.
Shinya Kawanaka
Comment 28
2011-08-30 01:07:49 PDT
Created
attachment 105592
[details]
Patch
Shinya Kawanaka
Comment 29
2011-08-30 01:09:26 PDT
(In reply to
comment #26
)
> > Could you tell me how to check which tab is focused...? > > The patch is in WebCore, so it should be affecting something other than just browser behavior. WebCore doesn't even know about tabs.
I've changed the patch so that WebCore does not know about tabs, I believe.
WebKit Review Bot
Comment 30
2011-08-30 01:33:59 PDT
Comment on
attachment 105592
[details]
Patch
Attachment 105592
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/9558535
New failing tests: http/tests/security/frameNavigation/xss-DENIED-plugin-navigation.html http/tests/security/frameNavigation/xss-DENIED-targeted-link-navigation.html
Alexey Proskuryakov
Comment 31
2011-08-30 09:04:11 PDT
Comment on
attachment 105592
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=105592&action=review
> Source/WebCore/loader/FrameLoaderClient.h:241 > + virtual bool requiresInitialFocusForTargetFrame(const NavigationAction& action) { return true; }
Safari has a user preference whether to activate new tabs and windows. It seems like you may be duplicating existing functionality when adding a new client call.
Ryosuke Niwa
Comment 32
2011-09-19 11:50:59 PDT
Comment on
attachment 105592
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=105592&action=review
> Source/WebCore/ChangeLog:3 > + Middle clicking a named target wrongly makes a tab foreground.
Why is the bug title different from "Middle clicking a named target sets a focus to a previously opened page" ?
Eric Seidel (no email)
Comment 33
2011-12-21 12:01:28 PST
Comment on
attachment 105592
[details]
Patch This patch seems to have numerous unanswered questions, and a break of cr-linux. marking r-. A new patch (and responses on the bug) will be needed to resolve these issues.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug