|
|
Created:
4 years, 2 months ago by Łukasz Anforowicz Modified:
4 years, 2 months ago CC:
Nate Chapin, blink-reviews, chromium-reviews, gavinp+loader_chromium.org, loading-reviews_chromium.org, nasko, site-isolation-reviews_chromium.org, tyoshino+watch_chromium.org Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionAvoiding going through RenderFrameProxy when targeting a *new* frame.
BUG=647772
Committed: https://crrev.com/e7250ebe260957a67131667cdde6b7b838a9b1f5
Cr-Commit-Position: refs/heads/master@{#426483}
Patch Set 1 #Patch Set 2 : Added a new browser test (which fails [as expected] before FrameLoader.cpp changes). #Patch Set 3 : Tweak the test to Command-Click instead of Ctrl-Click on a Mac. #
Total comments: 8
Patch Set 4 : Tried refactoring form-related workarounds (as suggested by japhet@). #Patch Set 5 : Avoid calling findFrameForNavigation twice (b/c of side-effects - console messages - impacting layo… #Patch Set 6 : Preparing for removal of one of form-related workarounds. #
Total comments: 4
Patch Set 7 : s/!canIgnoreTargetFrame/shouldNavigateTargetFrame/g #
Total comments: 2
Patch Set 8 : s/shift/ctrl/ in a "comment" in the test html file. #
Dependent Patchsets: Messages
Total messages: 41 (27 generated)
The CQ bit was checked by lukasza@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by lukasza@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...)
The CQ bit was checked by lukasza@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lukasza@chromium.org changed reviewers: + japhet@chromium.org
japhet@, could you please take a look? https://codereview.chromium.org/2410303006/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/loader/FrameLoader.cpp (left): https://codereview.chromium.org/2410303006/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/loader/FrameLoader.cpp:1068: Frame* targetFrame = request.form() I don't quite understand the reasoning behind making an exception for |request.form|. FWIW, I am keeping this exception in the current CL under review, so this should be fine. But... I wonder if this exception is in any way related to lack of support for POST requests in OpenURL path (which should be fixed now) and related to avoiding ShouldFork for POST requests (not yet fixed; work tracked by https://crbug.com/650694). If yes, then maybe I could look into removing special handling of forms (here and also in shouldOpenInNewWindow). https://codereview.chromium.org/2410303006/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/loader/FrameLoader.cpp (right): https://codereview.chromium.org/2410303006/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/loader/FrameLoader.cpp:1105: } Keeping |targetFrame| set to nullptr in case of Ctrl-Click / Shift-Click helps fix https://crbug.com/647772, because it: 1) continues to work as expected (because the navigation targets a *new* frame/tab, not |targetFrame|) 2) avoids going through RenderFrameProxy when |targetFrame| is a remote frame; before this CL, this would have happened below inside |if (targetFrame && targetFrame != m_frame)|.
This seems pretty reasonable, I just want to see if we can leave the code cleaner than we found it :) https://codereview.chromium.org/2410303006/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/loader/FrameLoader.cpp (left): https://codereview.chromium.org/2410303006/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/loader/FrameLoader.cpp:1068: Frame* targetFrame = request.form() On 2016/10/13 at 14:08:01, Łukasz Anforowicz wrote: > I don't quite understand the reasoning behind making an exception for |request.form|. FWIW, I am keeping this exception in the current CL under review, so this should be fine. > > But... I wonder if this exception is in any way related to lack of support for POST requests in OpenURL path (which should be fixed now) and related to avoiding ShouldFork for POST requests (not yet fixed; work tracked by https://crbug.com/650694). If yes, then maybe I could look into removing special handling of forms (here and also in shouldOpenInNewWindow). shouldOpenInNewWindow() excluding forms is definitely 650694, and I think this case is, too. https://codereview.chromium.org/2410303006/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/loader/FrameLoader.cpp (right): https://codereview.chromium.org/2410303006/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/loader/FrameLoader.cpp:1105: } On 2016/10/13 at 14:08:01, Łukasz Anforowicz wrote: > Keeping |targetFrame| set to nullptr in case of Ctrl-Click / Shift-Click helps fix https://crbug.com/647772, because it: > > 1) continues to work as expected (because the navigation targets a *new* frame/tab, not |targetFrame|) > > 2) avoids going through RenderFrameProxy when |targetFrame| is a remote frame; before this CL, this would have happened below inside |if (targetFrame && targetFrame != m_frame)|. Ideally, the shouldOpenInNewWindow() case would be in the same location as this logic. Can we put them together, and if so, does that allow for any simplifications?
My apologies for not replying earlier (I needed to look at another bug). I'll try to apply your suggestions and get back to you early next week.
The CQ bit was checked by lukasza@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: win_chromium_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_...)
The CQ bit was checked by lukasza@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
japhet@, could you please take another look? Unfortunately, I don't see how to clean-up or combine form-related workarounds, without bumping into a bunch of issues (please see my comments below). https://codereview.chromium.org/2410303006/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/loader/FrameLoader.cpp (left): https://codereview.chromium.org/2410303006/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/loader/FrameLoader.cpp:1068: Frame* targetFrame = request.form() On 2016/10/13 22:11:23, Nate Chapin wrote: > On 2016/10/13 at 14:08:01, Łukasz Anforowicz wrote: > > I don't quite understand the reasoning behind making an exception for > |request.form|. FWIW, I am keeping this exception in the current CL under > review, so this should be fine. > > > > But... I wonder if this exception is in any way related to lack of support for > POST requests in OpenURL path (which should be fixed now) and related to > avoiding ShouldFork for POST requests (not yet fixed; work tracked by > https://crbug.com/650694). If yes, then maybe I could look into removing > special handling of forms (here and also in shouldOpenInNewWindow). > > shouldOpenInNewWindow() excluding forms is definitely 650694 Actually, we don't need to fix https://crbug.com/650694 in order to remove the workaround. POST no longer downgrades to a GET for quite a while already (since June) - this has been fixed in my r400442. Unfortunately, there are still some blockers for removing the workaround: - content_shell doesn't support window dispositions other than CURRENT_TAB, which breaks http/tests/navigation/post-with-modifier.html layout test - even after adding content_shell support for NEW_WINDOW disposition, the test failed, because of the issue pointed out in a comment in https://crbug.com/606594#c1. This is a hairy issue to fix (I am trying to make some, but rather slow progress in https://codereview.chromium.org/2349063002/ and https://codereview.chromium.org/1814963002/). I am wondering whether it might make sense to replace http/tests/navigation/post-with-modifier.html with a browser test instead. WDYT? > and I think this case is, too. Maybe. I haven't yet looked into this too much. https://codereview.chromium.org/2410303006/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/loader/FrameLoader.cpp (right): https://codereview.chromium.org/2410303006/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/loader/FrameLoader.cpp:1105: } On 2016/10/13 22:11:23, Nate Chapin wrote: > On 2016/10/13 at 14:08:01, Łukasz Anforowicz wrote: > > Keeping |targetFrame| set to nullptr in case of Ctrl-Click / Shift-Click helps > fix https://crbug.com/647772, because it: > > > > 1) continues to work as expected (because the navigation targets a *new* > frame/tab, not |targetFrame|) > > > > 2) avoids going through RenderFrameProxy when |targetFrame| is a remote frame; > before this CL, this would have happened below inside |if (targetFrame && > targetFrame != m_frame)|. > > Ideally, the shouldOpenInNewWindow() case would be in the same location as this > logic. Can we put them together, and if so, does that allow for any > simplifications? Well, both shouldOpenInNewWindow as well as the |if (targetFrame && targetFrame != m_frame)| check are impacted by special-casing forms (and these 2 places are the only consumers of |targetFrame| variable). Still, I tried various changes described in https://docs.google.com/document/d/1fQIsKlua8aMUQhH7PvKOBlHxJsO9xR2KS0TjTZd-oIE and didn't get very far (both - the changes are not a big improvement + I couldn't get all the tests to pass). I am starting to think that even if there are refactoring opportunities here, we should do them in a separate CL (to keep the CL under review simple + to avoid the risk of it getting reverted because it bundles in some extra, opportunistic changes). FWIW, going through the exercise of breaking down various conditions helped me catch one issue (see https://docs.google.com/document/d/1fQIsKlua8aMUQhH7PvKOBlHxJsO9xR2KS0TjTZd-o...) and fix it in the latest patchset. PS. In the CL, I did end up moving things around, so that variables are introduced right next to the place where they are needed. I guess this is not quite the kind of cleanup you were hoping for... :-/
drive-by https://codereview.chromium.org/2410303006/diff/100001/third_party/WebKit/Sou... File third_party/WebKit/Source/core/loader/FrameLoader.cpp (right): https://codereview.chromium.org/2410303006/diff/100001/third_party/WebKit/Sou... third_party/WebKit/Source/core/loader/FrameLoader.cpp:972: static bool canIgnoreTargetFrame(NavigationPolicy policy) { Minor nit: shouldIgnoreTargetFrame() seems more consistent with the local naming convention.
https://codereview.chromium.org/2410303006/diff/100001/third_party/WebKit/Sou... File third_party/WebKit/Source/core/loader/FrameLoader.cpp (right): https://codereview.chromium.org/2410303006/diff/100001/third_party/WebKit/Sou... third_party/WebKit/Source/core/loader/FrameLoader.cpp:972: static bool canIgnoreTargetFrame(NavigationPolicy policy) { On 2016/10/18 23:18:34, dcheng wrote: > Minor nit: shouldIgnoreTargetFrame() seems more consistent with the local naming > convention. Thanks for pointing this out. I think this function answers "can ignore" rather than "should ignore" question - ignoring is optional for local frames (the behavior will be the same regardless of which frame we go through); ignoring is mandatory (i.e. a "should") only if the target is a remote frame (which doesn't handle window dispositions other than CURRENT_TAB).
blink lgtm https://codereview.chromium.org/2410303006/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/loader/FrameLoader.cpp (left): https://codereview.chromium.org/2410303006/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/loader/FrameLoader.cpp:1068: Frame* targetFrame = request.form() On 2016/10/18 23:13:17, Łukasz Anforowicz wrote: > On 2016/10/13 22:11:23, Nate Chapin wrote: > > On 2016/10/13 at 14:08:01, Łukasz Anforowicz wrote: > > > I don't quite understand the reasoning behind making an exception for > > |request.form|. FWIW, I am keeping this exception in the current CL under > > review, so this should be fine. > > > > > > But... I wonder if this exception is in any way related to lack of support > for > > POST requests in OpenURL path (which should be fixed now) and related to > > avoiding ShouldFork for POST requests (not yet fixed; work tracked by > > https://crbug.com/650694). If yes, then maybe I could look into removing > > special handling of forms (here and also in shouldOpenInNewWindow). > > > > shouldOpenInNewWindow() excluding forms is definitely 650694 > > Actually, we don't need to fix https://crbug.com/650694 in order to remove the > workaround. POST no longer downgrades to a GET for quite a while already (since > June) - this has been fixed in my r400442. Unfortunately, there are still some > blockers for removing the workaround: > - content_shell doesn't support window dispositions other than CURRENT_TAB, > which breaks http/tests/navigation/post-with-modifier.html layout test > - even after adding content_shell support for NEW_WINDOW disposition, the test > failed, because of the issue pointed out in a comment in > https://crbug.com/606594#c1. This is a hairy issue to fix (I am trying to make > some, but rather slow progress in https://codereview.chromium.org/2349063002/ > and https://codereview.chromium.org/1814963002/). > > I am wondering whether it might make sense to replace > http/tests/navigation/post-with-modifier.html with a browser test instead. > WDYT? Sounds like a good idea. > > > and I think this case is, too. > > Maybe. I haven't yet looked into this too much. https://codereview.chromium.org/2410303006/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/loader/FrameLoader.cpp (right): https://codereview.chromium.org/2410303006/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/loader/FrameLoader.cpp:1105: } On 2016/10/18 23:13:17, Łukasz Anforowicz wrote: > On 2016/10/13 22:11:23, Nate Chapin wrote: > > On 2016/10/13 at 14:08:01, Łukasz Anforowicz wrote: > > > Keeping |targetFrame| set to nullptr in case of Ctrl-Click / Shift-Click > helps > > fix https://crbug.com/647772, because it: > > > > > > 1) continues to work as expected (because the navigation targets a *new* > > frame/tab, not |targetFrame|) > > > > > > 2) avoids going through RenderFrameProxy when |targetFrame| is a remote > frame; > > before this CL, this would have happened below inside |if (targetFrame && > > targetFrame != m_frame)|. > > > > Ideally, the shouldOpenInNewWindow() case would be in the same location as > this > > logic. Can we put them together, and if so, does that allow for any > > simplifications? > > Well, both shouldOpenInNewWindow as well as the |if (targetFrame && targetFrame > != m_frame)| check are impacted by special-casing forms (and these 2 places are > the only consumers of |targetFrame| variable). > > Still, I tried various changes described in > https://docs.google.com/document/d/1fQIsKlua8aMUQhH7PvKOBlHxJsO9xR2KS0TjTZd-oIE > and didn't get very far (both - the changes are not a big improvement + I > couldn't get all the tests to pass). I am starting to think that even if there > are refactoring opportunities here, we should do them in a separate CL (to keep > the CL under review simple + to avoid the risk of it getting reverted because it > bundles in some extra, opportunistic changes). > > FWIW, going through the exercise of breaking down various conditions helped me > catch one issue (see > https://docs.google.com/document/d/1fQIsKlua8aMUQhH7PvKOBlHxJsO9xR2KS0TjTZd-o...) > and fix it in the latest patchset. > > PS. In the CL, I did end up moving things around, so that variables are > introduced right next to the place where they are needed. I guess this is not > quite the kind of cleanup you were hoping for... :-/ Yeah, sorry for all the form-related frame targeting workarounds. I tried to remove them a few years ago, but I broke salesforce in a fairly major way...right before they were planning on show off their new features in chrome in the keynote of their big conference. Many people had a very stressful few days as a result, and I got scared of trying to resolve it :)
https://codereview.chromium.org/2410303006/diff/100001/third_party/WebKit/Sou... File third_party/WebKit/Source/core/loader/FrameLoader.cpp (right): https://codereview.chromium.org/2410303006/diff/100001/third_party/WebKit/Sou... third_party/WebKit/Source/core/loader/FrameLoader.cpp:972: static bool canIgnoreTargetFrame(NavigationPolicy policy) { On 2016/10/18 23:26:45, Łukasz Anforowicz wrote: > On 2016/10/18 23:18:34, dcheng wrote: > > Minor nit: shouldIgnoreTargetFrame() seems more consistent with the local > naming > > convention. > > Thanks for pointing this out. I think this function answers "can ignore" rather > than "should ignore" question - ignoring is optional for local frames (the > behavior will be the same regardless of which frame we go through); ignoring is > mandatory (i.e. a "should") only if the target is a remote frame (which doesn't > handle window dispositions other than CURRENT_TAB). Shrug, I don't think can or should imply mandatory-ness. And in any case, we don't differentiate (here) based on whether target frame is local or remote, AFAICT.
lukasza@chromium.org changed reviewers: + alexmos@chromium.org
Alex, can you take a look please? https://codereview.chromium.org/2410303006/diff/100001/third_party/WebKit/Sou... File third_party/WebKit/Source/core/loader/FrameLoader.cpp (right): https://codereview.chromium.org/2410303006/diff/100001/third_party/WebKit/Sou... third_party/WebKit/Source/core/loader/FrameLoader.cpp:972: static bool canIgnoreTargetFrame(NavigationPolicy policy) { On 2016/10/18 23:42:00, dcheng wrote: > On 2016/10/18 23:26:45, Łukasz Anforowicz wrote: > > On 2016/10/18 23:18:34, dcheng wrote: > > > Minor nit: shouldIgnoreTargetFrame() seems more consistent with the local > > naming > > > convention. > > > > Thanks for pointing this out. I think this function answers "can ignore" > rather > > than "should ignore" question - ignoring is optional for local frames (the > > behavior will be the same regardless of which frame we go through); ignoring > is > > mandatory (i.e. a "should") only if the target is a remote frame (which > doesn't > > handle window dispositions other than CURRENT_TAB). > > Shrug, I don't think can or should imply mandatory-ness. Well, there is a difference in how strongly compliance is requested via "can" vs "should", right? > And in any case, we don't differentiate (here) based on whether target frame is > local or remote, AFAICT. Ack. FWIW, I've reversed the condition being checked here into something that looks good (to me) with a "should" - instead of checking if !canIgnoreTargetFrame(policy) now I am checking shouldNavigateTargetFrame(policy). Maybe it is indeed cleaner this way :-)
The CQ bit was checked by lukasza@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
LGTM https://codereview.chromium.org/2410303006/diff/120001/chrome/test/data/frame... File chrome/test/data/frame_tree/anchor_targeting_remote_frame.html (right): https://codereview.chromium.org/2410303006/diff/120001/chrome/test/data/frame... chrome/test/data/frame_tree/anchor_targeting_remote_frame.html:20: id="test-anchor">Test link to click while holding shift key</a> nit: s/shift/ctrl/, since that's what the test does?
Thanks for reviewing everyone. I'll push to CQ tomorrow. https://codereview.chromium.org/2410303006/diff/120001/chrome/test/data/frame... File chrome/test/data/frame_tree/anchor_targeting_remote_frame.html (right): https://codereview.chromium.org/2410303006/diff/120001/chrome/test/data/frame... chrome/test/data/frame_tree/anchor_targeting_remote_frame.html:20: id="test-anchor">Test link to click while holding shift key</a> On 2016/10/19 23:48:30, alexmos wrote: > nit: s/shift/ctrl/, since that's what the test does? Done.
The CQ bit was checked by lukasza@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from japhet@chromium.org, alexmos@chromium.org Link to the patchset: https://codereview.chromium.org/2410303006/#ps140001 (title: "s/shift/ctrl/ in a "comment" in the test html file.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Committed patchset #8 (id:140001)
Message was sent while issue was closed.
Description was changed from ========== Avoiding going through RenderFrameProxy when targeting a *new* frame. BUG=647772 ========== to ========== Avoiding going through RenderFrameProxy when targeting a *new* frame. BUG=647772 Committed: https://crrev.com/e7250ebe260957a67131667cdde6b7b838a9b1f5 Cr-Commit-Position: refs/heads/master@{#426483} ==========
Message was sent while issue was closed.
Patchset 8 (id:??) landed as https://crrev.com/e7250ebe260957a67131667cdde6b7b838a9b1f5 Cr-Commit-Position: refs/heads/master@{#426483} |