Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1365)

Issue 1358153002: Issue AboutToNavigateRenderFrame notification after beforeunload handling. (Closed)

Created:
5 years, 3 months ago by dgozman
Modified:
5 years, 2 months ago
Reviewers:
Charlie Reis, nasko, yurys
CC:
chromium-reviews, jam, nasko+codewatch_chromium.org, creis+watch_chromium.org, darin-cc_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Issue AboutToNavigateRenderFrame notification after beforeunload handling. Debugger can stop the renderer in beforeunload handling, and navigation will not proceed. Thus, moving the notification after beforeunload ack is received seems logical. This allows DevTools to correctly handle beforeunload breakpoint case. BUG=131371

Patch Set 1 #

Total comments: 1

Patch Set 2 : test fixes #

Total comments: 14
Unified diffs Side-by-side diffs Delta from patch set Stats (+17 lines, -4 lines) Patch
M content/browser/devtools/protocol/devtools_protocol_browsertest.cc View 1 4 chunks +9 lines, -3 lines 3 comments Download
M content/browser/frame_host/navigator_impl.cc View 1 chunk +1 line, -1 line 3 comments Download
M content/browser/frame_host/render_frame_host_manager.cc View 1 1 chunk +7 lines, -0 lines 8 comments Download

Messages

Total messages: 19 (6 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1358153002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1358153002/1
5 years, 3 months ago (2015-09-22 18:22:20 UTC) #2
dgozman
Hi Nasko, Could you please take a look? I think this is conceptually right, but ...
5 years, 3 months ago (2015-09-22 18:23:33 UTC) #4
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_asan_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_asan_rel_ng/builds/56101) linux_chromium_chromeos_rel_ng on ...
5 years, 3 months ago (2015-09-22 18:53:47 UTC) #6
yurys
This approach should fix the bug but I'd rather have a single place where FrameMsg_Navigate ...
5 years, 3 months ago (2015-09-22 19:31:43 UTC) #7
nasko
Hey Charlie, Can you take a look at this? I won't be able to look ...
5 years, 3 months ago (2015-09-22 20:46:42 UTC) #9
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1358153002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1358153002/20001
5 years, 3 months ago (2015-09-22 20:52:10 UTC) #11
dgozman
https://codereview.chromium.org/1358153002/diff/20001/content/browser/frame_host/render_frame_host_manager.cc File content/browser/frame_host/render_frame_host_manager.cc (right): https://codereview.chromium.org/1358153002/diff/20001/content/browser/frame_host/render_frame_host_manager.cc#newcode562 content/browser/frame_host/render_frame_host_manager.cc:562: pending_render_frame_host_->ShouldDispatchBeforeUnload()) { This unfortunate check is here to not ...
5 years, 3 months ago (2015-09-22 20:54:30 UTC) #12
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: win8_chromium_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win8_chromium_ng/builds/44061)
5 years, 3 months ago (2015-09-22 21:21:54 UTC) #14
Charlie Reis
Hmm, I don't understand what impact this change has. Maybe you can clarify in the ...
5 years, 3 months ago (2015-09-22 23:12:10 UTC) #15
dgozman
> Hmm, I don't understand what impact this change has. Maybe you can clarify in ...
5 years, 3 months ago (2015-09-22 23:27:56 UTC) #16
Charlie Reis
On 2015/09/22 23:27:56, dgozman wrote: > > Hmm, I don't understand what impact this change ...
5 years, 3 months ago (2015-09-22 23:56:43 UTC) #17
dgozman
> > This should be pretty safe, as we are the only client of > ...
5 years, 3 months ago (2015-09-23 00:05:21 UTC) #18
Charlie Reis
5 years, 3 months ago (2015-09-23 00:09:54 UTC) #19
On Tue, Sep 22, 2015 at 5:05 PM, <dgozman@chromium.org> wrote:

> > This should be pretty safe, as we are the only client of
>> > AboutToNavigateRenderFrame. Perhaps, we can event remove it from
>> observer
>>
> and
>
>> > use a private call, similar to
>> > RenderFrameDevToolsAgentHost::OnCancelPendingNavigation?
>>
>
> Yes-- I'd love to have AboutToNavigateRenderFrame moved off
>>
> WebContentsObserver!
>
> Ok, I will try to do this.
>
> Ok, thanks.  It'd probably be worthwhile to include a test for the change
>> once
>> we settle on the right approach, if possible.
>>
>
> Sure! Just didn't want to work on test until the path is clear.
>
>
>
>
>
https://codereview.chromium.org/1358153002/diff/20001/content/browser/frame_h...
>
>> File content/browser/frame_host/navigator_impl.cc (right):
>>
>
>
>
>
https://codereview.chromium.org/1358153002/diff/20001/content/browser/frame_h...
>
>> content/browser/frame_host/navigator_impl.cc:318:
>>
>> delegate_->AboutToNavigateRenderFrame(frame_tree_node->current_frame_host(),
>> On 2015/09/22 23:27:55, dgozman wrote:
>> > On 2015/09/22 23:12:10, Charlie Reis wrote:
>> > > What's happening in AboutToNavigateRenderFrame that must be delayed
>> until
>> > after
>> > > the beforeunload handler?
>> >
>> > It's called from another place.
>>
>
> That didn't really answer my question, though.
>>
>
> Sorry, misunderstood the question. The problem is we ignore messages from
> the
> renderer once navigation has started, including the "stopped on
> breakpoint" one.
>
>
> What is DevTools doing in AboutToNavigateRenderFrame that needs to be
>> delayed?
>>
>
> >
>> > >
>> > > I'm confused, because even after this change, the browser process will
>>
> time
>
>> > out
>> > > and allow the navigation to proceed if there's a breakpoint in
>>
> beforeunload.
>
> > > What's different about firing AboutToNavigateRenderFrame later?
>> >
>> > I didn't know about the timeout. How long is that? I didn't notice it
>> while
>> > testing locally.
>>
>
> RenderFrameHostImpl::DispatchBeforeUnload sets a timer for
>> kUnloadTimeoutMS,
>> which is only 1 second.
>>
>
> That means that the navigation will likely try to proceed while the
>> breakpoint
>> is hit, which seems wrong-- we'll be calling AboutToNavigateRenderFrame 1
>>
> second
>
>> later than before, but still during the breakpoint.  (I imagine the
>> timeout is
>> part of the problem in today's behavior as well, though I'm not sure how
>> that
>> leads to the hang.)
>>
>
> Hmm... With this patch, I'm able to step over and continue way after 1
> second.
> I'll dig more to see what happens.


Maybe that's because we aren't calling AboutToNavigateRenderFrame from
ShouldCloseTabOnUnresponsiveRenderer?  That would probably hide this
problem but cause other problems if the timeout fires in practice without
having a breakpoint in beforeunload.

Anyway, gotta run but I can discuss more tomorrow.


>
> > > This is almost certainly not what you want to do.  Why would it matter
>> whether
>> > > the pending (destination) RFH has a beforeunload handler?  In most
>> cases,
>> > we've
>> > > just created that RFH and it hasn't loaded a page yet.
>> > >
>> > > I also don't understand how it relates to the subframe case you
>> describe.
>>
>
> Well, we immediately ACK for subframes (as I understand it). This happens
> synchronously, so the code in NavigatorImpl doesn't have a chance to see
> that
> beforeunload was kind of handled. See
>
>
https://code.google.com/p/chromium/codesearch#chromium/src/content/browser/fr...
> .
>
> > I was hesitant about moving notifications between delegates. But if it's
>> ok,
>>
> I
>
>> > will surely do that. Just needed a blessing from content owner.
>>
>
> Yep, it's fine.  And even better if we can remove the method from
>> WebContentsObserver, as you suggest.
>>
>
> I will use this approach and update the patch.
>
> https://codereview.chromium.org/1358153002/
>

To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698