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

Issue 2421943002: Make JavaScript dialogs auto-dismiss on tab switch. (Closed)

Created:
4 years, 2 months ago by Avi (use Gerrit)
Modified:
4 years, 1 month ago
CC:
chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make JavaScript dialogs auto-dismiss on tab switch. This is a Views-only implementation for now. This works on the Mac too, but is ugly; a real Mac version is to come. Behind the feature flag "AutoDismissingDialogs". BUG=629964 Committed: https://crrev.com/7a1b55bb6e44c34caad1913f8ca4ca43b917eb29 Cr-Commit-Position: refs/heads/master@{#426133}

Patch Set 1 #

Patch Set 2 : android #

Patch Set 3 : close dialogs on window switch #

Patch Set 4 : android #

Patch Set 5 : fix #

Total comments: 38

Patch Set 6 : pkasting #

Total comments: 15

Patch Set 7 : more commentary, nits #

Total comments: 4

Patch Set 8 : last fixes #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+375 lines, -76 lines) Patch
M chrome/browser/ui/BUILD.gn View 1 2 3 4 5 2 chunks +4 lines, -2 lines 0 comments Download
M chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h View 1 2 3 4 5 6 7 2 chunks +38 lines, -3 lines 0 comments Download
M chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc View 1 2 3 4 5 6 7 6 chunks +87 lines, -19 lines 2 comments Download
A chrome/browser/ui/javascript_dialogs/javascript_dialog_views.h View 1 2 3 4 5 6 7 1 chunk +83 lines, -0 lines 0 comments Download
A chrome/browser/ui/javascript_dialogs/javascript_dialog_views.cc View 1 2 3 4 5 6 7 1 chunk +119 lines, -0 lines 0 comments Download
M chrome/browser/ui/tab_helpers.cc View 1 2 4 chunks +2 lines, -2 lines 0 comments Download
M components/app_modal/javascript_dialog_manager.h View 2 chunks +8 lines, -8 lines 0 comments Download
M components/app_modal/javascript_dialog_manager.cc View 1 2 3 4 5 6 5 chunks +34 lines, -42 lines 0 comments Download

Messages

Total messages: 52 (35 generated)
Avi (use Gerrit)
Peter: You're a UI-type peep, so I was wondering if I could run some reviews ...
4 years, 2 months ago (2016-10-15 02:31:15 UTC) #18
Peter Kasting
Mostly nits https://codereview.chromium.org/2421943002/diff/80001/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc File chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc (right): https://codereview.chromium.org/2421943002/diff/80001/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc#newcode38 chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc:38: DCHECK(false); Do not handle DCHECK failure (banned ...
4 years, 2 months ago (2016-10-17 20:16:05 UTC) #23
Avi (use Gerrit)
https://codereview.chromium.org/2421943002/diff/80001/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc File chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc (right): https://codereview.chromium.org/2421943002/diff/80001/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc#newcode38 chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc:38: DCHECK(false); On 2016/10/17 20:16:04, Peter Kasting wrote: > Do ...
4 years, 2 months ago (2016-10-18 02:46:42 UTC) #28
Peter Kasting
LGTM if you resolve the issue about Close() below. The other stuff is all minor ...
4 years, 2 months ago (2016-10-18 04:31:04 UTC) #29
Avi (use Gerrit)
https://codereview.chromium.org/2421943002/diff/80001/chrome/browser/ui/javascript_dialogs/javascript_dialog_views.cc File chrome/browser/ui/javascript_dialogs/javascript_dialog_views.cc (right): https://codereview.chromium.org/2421943002/diff/80001/chrome/browser/ui/javascript_dialogs/javascript_dialog_views.cc#newcode64 chrome/browser/ui/javascript_dialogs/javascript_dialog_views.cc:64: dialog_callback_.Reset(); On 2016/10/18 04:31:03, Peter Kasting wrote: > What ...
4 years, 2 months ago (2016-10-18 16:31:49 UTC) #31
Peter Kasting
Quick, submit now before I have a chance to meaninglessly wordsmith more things!! (Still LGTM) ...
4 years, 2 months ago (2016-10-18 16:59:56 UTC) #33
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2421943002/140001
4 years, 2 months ago (2016-10-18 17:06:06 UTC) #36
Avi (use Gerrit)
Committing. BTW, I do expect someone modifying the JavaScriptDialogTabHelper code to know the basic JavaScriptDialogManager ...
4 years, 2 months ago (2016-10-18 17:06:07 UTC) #37
commit-bot: I haz the power
Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/162631)
4 years, 2 months ago (2016-10-18 17:41:27 UTC) #39
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2421943002/140001
4 years, 2 months ago (2016-10-18 19:30:05 UTC) #41
commit-bot: I haz the power
Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/162720)
4 years, 2 months ago (2016-10-18 22:02:47 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2421943002/140001
4 years, 2 months ago (2016-10-19 02:19:27 UTC) #45
commit-bot: I haz the power
Committed patchset #8 (id:140001)
4 years, 2 months ago (2016-10-19 04:19:06 UTC) #46
commit-bot: I haz the power
Patchset 8 (id:??) landed as https://crrev.com/7a1b55bb6e44c34caad1913f8ca4ca43b917eb29 Cr-Commit-Position: refs/heads/master@{#426133}
4 years, 2 months ago (2016-10-21 13:06:26 UTC) #48
jochen (gone - plz use gerrit)
https://codereview.chromium.org/2421943002/diff/140001/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc File chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc (right): https://codereview.chromium.org/2421943002/diff/140001/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc#newcode110 chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc:110: parent_web_contents->GetDelegate()->ActivateContents(parent_web_contents); will this defeat the pop-under blocker? In the ...
4 years, 1 month ago (2016-10-27 15:16:03 UTC) #50
Avi (use Gerrit)
https://codereview.chromium.org/2421943002/diff/140001/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc File chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc (right): https://codereview.chromium.org/2421943002/diff/140001/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc#newcode110 chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc:110: parent_web_contents->GetDelegate()->ActivateContents(parent_web_contents); On 2016/10/27 15:16:03, jochen wrote: > will this ...
4 years, 1 month ago (2016-10-28 14:18:07 UTC) #51
jochen (gone - plz use gerrit)
4 years, 1 month ago (2016-10-28 14:19:51 UTC) #52
Message was sent while issue was closed.
On 2016/10/28 at 14:18:07, avi wrote:
>
https://codereview.chromium.org/2421943002/diff/140001/chrome/browser/ui/java...
> File chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc
(right):
> 
>
https://codereview.chromium.org/2421943002/diff/140001/chrome/browser/ui/java...
> chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc:110:
parent_web_contents->GetDelegate()->ActivateContents(parent_web_contents);
> On 2016/10/27 15:16:03, jochen wrote:
> > will this defeat the pop-under blocker? In the old code path, we've created
an
> > AppModalDialogHelper before activating the contents, so if there was an
popup
> > before the web contents got raised, it will be restored after the dialog
closes.
> 
> I was not aware of the interaction with the popup blocker and this code; thank
you for bringing it to my attention.
> 
> So that I understand, let me summarize what I think your concern is.
> 
> The attack is to open a popup window and then show a JS alert, using the alert
to raise the alerting window, in the hopes that the alerting window stays
z-ordered above the popup window. The dialog helper captures the active window
before activating the alerting window, and restores it when the alert is
complete.
> 
that's correct. However, there's one more thing: sites dismiss the prompt
themselves, e.g., by triggering it via pdf and destroying the plugin element, so
there's no user interaction required.

> I think we should talk, because that paragraph is the extent of my knowledge
about the dialog helper, and I'm having trouble working out the interaction
between the auto-dismissing behavior of these new JS alerts and the dialog
helper. In particular, the new JS alerts auto-dismiss when you switch away from
the alerting tab. If you switch away to a different tab in the same window, I
think we're OK switching back to the previously-active window, but if you switch
away to a different window, we can't lose the user's focus intent.

Powered by Google App Engine
This is Rietveld 408576698