|
|
Created:
4 years, 1 month ago by zmin Modified:
4 years, 1 month ago CC:
chromium-reviews, michaelpg+watch-md-settings_chromium.org, michaelpg+watch-md-ui_chromium.org, dbeam+watch-settings_chromium.org, stevenjb+watch-md-settings_chromium.org, arv+watch_chromium.org, tommycli Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionMake sure that the browser will always restore settings page instead of sign out page after user sign out and sign in again with force sign in enabled.
BUG=642059
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
Committed: https://crrev.com/be19af93c39dc51d3dddf65950869f98d54338e3
Cr-Commit-Position: refs/heads/master@{#432251}
Patch Set 1 #
Total comments: 10
Patch Set 2 : sky's comments #Patch Set 3 : append the missing file #
Total comments: 13
Patch Set 4 : dbeam's comments #Patch Set 5 : rebase from master #
Messages
Total messages: 53 (37 generated)
Description was changed from ========== Make sure that the browser will always restore settings page instead of sign out page after user sign out and sign in again with force sign in enabled. BUG=642059 ========== to ========== Make sure that the browser will always restore settings page instead of sign out page after user sign out and sign in again with force sign in enabled. BUG=642059 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ==========
The CQ bit was checked by zmin@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...
zmin@chromium.org changed reviewers: + sky@chromium.org, tommycli@chromium.org
tommycli@chromium.org: Please review changes in chrome/browser/resources/settings/people_page/people_page.js sky@chromium.org: Please review changes in chrome/browser/sessions/session_restore.cc chrome/browser/sessions/session_restore_browsertest.cc
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2493573002/diff/1/chrome/browser/sessions/ses... File chrome/browser/sessions/session_restore.cc (right): https://codereview.chromium.org/2493573002/diff/1/chrome/browser/sessions/ses... chrome/browser/sessions/session_restore.cc:578: int GetSelectedIndex(const sessions::SessionTab& tab) { This only effects session restore, what about tab restore? https://codereview.chromium.org/2493573002/diff/1/chrome/browser/sessions/ses... chrome/browser/sessions/session_restore.cc:578: int GetSelectedIndex(const sessions::SessionTab& tab) { I have a mild preference for moving this to SessionService::OnGotSessionCommands. https://codereview.chromium.org/2493573002/diff/1/chrome/browser/sessions/ses... chrome/browser/sessions/session_restore.cc:589: setting_page_url + std::string(chrome::kSignOutSubPage); Is there a reason you care about this case, and say not always removing the sign out page? https://codereview.chromium.org/2493573002/diff/1/chrome/browser/sessions/ses... chrome/browser/sessions/session_restore.cc:591: tab.navigations.at(selected_index).virtual_url().spec() == at() -> [] (same comment below). https://codereview.chromium.org/2493573002/diff/1/chrome/browser/sessions/ses... File chrome/browser/sessions/session_restore_browsertest.cc (right): https://codereview.chromium.org/2493573002/diff/1/chrome/browser/sessions/ses... chrome/browser/sessions/session_restore_browsertest.cc:1415: IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoresSignOutPage) { Writing a browser test for this is very heavy. How about moving the function you care about into a static function that can be called from the test?
The CQ bit was checked by zmin@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...
https://codereview.chromium.org/2493573002/diff/1/chrome/browser/sessions/ses... File chrome/browser/sessions/session_restore.cc (right): https://codereview.chromium.org/2493573002/diff/1/chrome/browser/sessions/ses... chrome/browser/sessions/session_restore.cc:578: int GetSelectedIndex(const sessions::SessionTab& tab) { On 2016/11/09 22:24:04, sky wrote: > This only effects session restore, what about tab restore? I want to scope the affect of this change as little as possible. The only scenario is "user sign out + browser close and then sign in again" which is covered by this CL very well based on my test. Including browser automatically restore everything or manually restore the setting page by click History->Recently closed. And any other restore process should still restore the sign out page as what we have now. https://codereview.chromium.org/2493573002/diff/1/chrome/browser/sessions/ses... chrome/browser/sessions/session_restore.cc:578: int GetSelectedIndex(const sessions::SessionTab& tab) { On 2016/11/09 22:24:04, sky wrote: > I have a mild preference for moving this to > SessionService::OnGotSessionCommands. OnGotSessionCommands is a simple function. Moving this to there means I have to go through each tabs again which has additional performance cost. https://codereview.chromium.org/2493573002/diff/1/chrome/browser/sessions/ses... chrome/browser/sessions/session_restore.cc:589: setting_page_url + std::string(chrome::kSignOutSubPage); On 2016/11/09 22:24:04, sky wrote: > Is there a reason you care about this case, and say not always removing the sign > out page? There're some edge cases I'm thinking about. For example, there're multiple sign out sub pages in the navigation list so moving the index does nothing. Or the previous page is totally unrelated as the sign out page url is typed manually by user. "Always removing" might be too complicated here and I just want to keep the thing simple here because it's enough to cover the use case which is "user sign out then sign in again with force sign in" https://codereview.chromium.org/2493573002/diff/1/chrome/browser/sessions/ses... chrome/browser/sessions/session_restore.cc:591: tab.navigations.at(selected_index).virtual_url().spec() == On 2016/11/09 22:24:04, sky wrote: > at() -> [] (same comment below). Done. https://codereview.chromium.org/2493573002/diff/1/chrome/browser/sessions/ses... File chrome/browser/sessions/session_restore_browsertest.cc (right): https://codereview.chromium.org/2493573002/diff/1/chrome/browser/sessions/ses... chrome/browser/sessions/session_restore_browsertest.cc:1415: IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoresSignOutPage) { On 2016/11/09 22:24:04, sky wrote: > Writing a browser test for this is very heavy. How about moving the function you > care about into a static function that can be called from the test? I moved this function to session_common_utils.cc and add a unit test for it.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_compile_dbg_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
Patchset #2 (id:20001) has been deleted
The CQ bit was checked by zmin@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: linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by zmin@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: android_compile_dbg on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_comp...) linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_androi...)
LGTM - but get another reviewer for the js changes. https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/resource... File chrome/browser/resources/settings/people_page/people_page.js (right): https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/resource... chrome/browser/resources/settings/people_page/people_page.js:234: this.dispatchEvent(new Event('signout-dialog-closed')); I'm not a good reviewer for the changes to this file. Please find another reviewer. https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/sessions... File chrome/browser/sessions/session_common_utils.cc (right): https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/sessions... chrome/browser/sessions/session_common_utils.cc:23: selected_index = std::max( optional: avoid multiple statements and do the assignment at the same time (as well as making selected_index const). https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/sessions... chrome/browser/sessions/session_common_utils.cc:25: std::min(selected_index, static_cast<int>(tab.navigations.size() - 1))); DCHECK !tab.navigations.empty() ? I realize the check for empty occurs in session_restore, but the DCHECK helps document the expectation. https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/sessions... chrome/browser/sessions/session_common_utils.cc:38: selected_index -= 1; optional: I would early return at this point, e.g. return selected_index - 1; https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/sessions... File chrome/browser/sessions/session_common_utils.h (right): https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/sessions... chrome/browser/sessions/session_common_utils.h:22: int GetSelectedIndexFromTab(const sessions::SessionTab& tab); Selected-index is rather generic in this case. How about GetNavigationIndexToSelect?
dbeam@chromium.org changed reviewers: + dbeam@chromium.org
can we write or update a test for this code in chrome/test/data/webui/settings/? there's probably already a lot of people page-y stuff there https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/resource... File chrome/browser/resources/settings/people_page/people_page.js (right): https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/resource... chrome/browser/resources/settings/people_page/people_page.js:234: this.dispatchEvent(new Event('signout-dialog-closed')); this.fire('signout-dialog-closed'); https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/resource... chrome/browser/resources/settings/people_page/people_page.js:257: listenOnce(this, 'signout-dialog-closed', function callback() { no need to name this "callback", just: listenOnce(this, 'signout-dialog-closed', function() { this.syncBrowserProxy_.signOut(deleteProfile); }.bind(this)); also, is there any reason not just listen for this type of event all the time? i.e. Polymer({ ... listeners: { 'signout-dialog-closed': 'onSignoutDialogClosed_', }, /** @private */ onSignoutDialogClosed_: function() { this.syncBrowserProxy_.signOut(deleteProfile); }, });
The CQ bit was checked by zmin@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...
I have looked at the test of peopel_page.js and I think the existed test case has covered this CL well including tab sign out button and verity the sign out function has been called. https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/resource... File chrome/browser/resources/settings/people_page/people_page.js (right): https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/resource... chrome/browser/resources/settings/people_page/people_page.js:234: this.dispatchEvent(new Event('signout-dialog-closed')); On 2016/11/11 01:56:46, Dan Beam wrote: > this.fire('signout-dialog-closed'); Done. https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/resource... chrome/browser/resources/settings/people_page/people_page.js:257: listenOnce(this, 'signout-dialog-closed', function callback() { On 2016/11/11 01:56:46, Dan Beam wrote: > no need to name this "callback", just: > > listenOnce(this, 'signout-dialog-closed', function() { > this.syncBrowserProxy_.signOut(deleteProfile); > }.bind(this)); > > also, is there any reason not just listen for this type of event all the time? > i.e. > > Polymer({ > > ... > > listeners: { > 'signout-dialog-closed': 'onSignoutDialogClosed_', > }, > > /** @private */ > onSignoutDialogClosed_: function() { > this.syncBrowserProxy_.signOut(deleteProfile); > }, > }); Remove callback and, no it can't listen this even all the time. Because not all sign out dialog closing ends up with the sign out. User cancel the sign out will also close the sign out dialog. https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/sessions... File chrome/browser/sessions/session_common_utils.cc (right): https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/sessions... chrome/browser/sessions/session_common_utils.cc:23: selected_index = std::max( On 2016/11/11 00:32:17, sky wrote: > optional: avoid multiple statements and do the assignment at the same time (as > well as making selected_index const). Done. https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/sessions... chrome/browser/sessions/session_common_utils.cc:25: std::min(selected_index, static_cast<int>(tab.navigations.size() - 1))); On 2016/11/11 00:32:17, sky wrote: > DCHECK !tab.navigations.empty() ? I realize the check for empty occurs in > session_restore, but the DCHECK helps document the expectation. Done. https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/sessions... chrome/browser/sessions/session_common_utils.cc:38: selected_index -= 1; On 2016/11/11 00:32:17, sky wrote: > optional: I would early return at this point, e.g. return selected_index - 1; Done. https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/sessions... File chrome/browser/sessions/session_common_utils.h (right): https://codereview.chromium.org/2493573002/diff/60001/chrome/browser/sessions... chrome/browser/sessions/session_common_utils.h:22: int GetSelectedIndexFromTab(const sessions::SessionTab& tab); On 2016/11/11 00:32:17, sky wrote: > Selected-index is rather generic in this case. How about > GetNavigationIndexToSelect? Done.
lgtm
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Description was changed from ========== Make sure that the browser will always restore settings page instead of sign out page after user sign out and sign in again with force sign in enabled. BUG=642059 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ========== to ========== Make sure that the browser will always restore settings page instead of sign out page after user sign out and sign in again with force sign in enabled. BUG=642059 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ==========
zmin@chromium.org changed reviewers: - tommycli@chromium.org
The CQ bit was checked by zmin@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from sky@chromium.org Link to the patchset: https://codereview.chromium.org/2493573002/#ps80001 (title: "dbeam's comments")
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
Failed to apply patch for chrome/browser/sessions/session_common_utils.cc: While running git apply --index -p1; error: patch failed: chrome/browser/sessions/session_common_utils.cc:13 error: chrome/browser/sessions/session_common_utils.cc: patch does not apply Patch: chrome/browser/sessions/session_common_utils.cc Index: chrome/browser/sessions/session_common_utils.cc diff --git a/chrome/browser/sessions/session_common_utils.cc b/chrome/browser/sessions/session_common_utils.cc index 75973b73afa83d823ab1c05efe8b9bea2e52b675..09e8e5f369c55f8f7c5e5d64582881cb945bfd3d 100644 --- a/chrome/browser/sessions/session_common_utils.cc +++ b/chrome/browser/sessions/session_common_utils.cc @@ -4,7 +4,11 @@ #include "chrome/browser/sessions/session_common_utils.h" +#include <algorithm> +#include <string> + #include "chrome/common/url_constants.h" +#include "components/sessions/core/session_types.h" #include "url/gurl.h" bool ShouldTrackURLForRestore(const GURL& url) { @@ -13,3 +17,26 @@ bool ShouldTrackURLForRestore(const GURL& url) { (url.host() == chrome::kChromeUIQuitHost || url.host() == chrome::kChromeUIRestartHost)); } + +int GetNavigationIndexToSelect(const sessions::SessionTab& tab) { + DCHECK(!tab.navigations.empty()); + const int selected_index = + std::max(0, std::min(tab.current_navigation_index, + static_cast<int>(tab.navigations.size() - 1))); + + // After user sign out, Chrome may navigate to the setting page from the + // sign out page asynchronously. The browser may be closed before the + // navigation callback finished. + std::string setting_page_url = std::string(chrome::kChromeUISettingsURL); + std::string sign_out_page_url = + setting_page_url + std::string(chrome::kSignOutSubPage); + if (selected_index > 0 && + tab.navigations[selected_index].virtual_url().spec() == + sign_out_page_url && + tab.navigations[selected_index - 1].virtual_url().spec() == + setting_page_url) { + return selected_index - 1; + } + + return selected_index; +}
The CQ bit was checked by zmin@chromium.org
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
Failed to apply patch for chrome/browser/sessions/session_common_utils.cc: While running git apply --index -p1; error: patch failed: chrome/browser/sessions/session_common_utils.cc:13 error: chrome/browser/sessions/session_common_utils.cc: patch does not apply Patch: chrome/browser/sessions/session_common_utils.cc Index: chrome/browser/sessions/session_common_utils.cc diff --git a/chrome/browser/sessions/session_common_utils.cc b/chrome/browser/sessions/session_common_utils.cc index 75973b73afa83d823ab1c05efe8b9bea2e52b675..09e8e5f369c55f8f7c5e5d64582881cb945bfd3d 100644 --- a/chrome/browser/sessions/session_common_utils.cc +++ b/chrome/browser/sessions/session_common_utils.cc @@ -4,7 +4,11 @@ #include "chrome/browser/sessions/session_common_utils.h" +#include <algorithm> +#include <string> + #include "chrome/common/url_constants.h" +#include "components/sessions/core/session_types.h" #include "url/gurl.h" bool ShouldTrackURLForRestore(const GURL& url) { @@ -13,3 +17,26 @@ bool ShouldTrackURLForRestore(const GURL& url) { (url.host() == chrome::kChromeUIQuitHost || url.host() == chrome::kChromeUIRestartHost)); } + +int GetNavigationIndexToSelect(const sessions::SessionTab& tab) { + DCHECK(!tab.navigations.empty()); + const int selected_index = + std::max(0, std::min(tab.current_navigation_index, + static_cast<int>(tab.navigations.size() - 1))); + + // After user sign out, Chrome may navigate to the setting page from the + // sign out page asynchronously. The browser may be closed before the + // navigation callback finished. + std::string setting_page_url = std::string(chrome::kChromeUISettingsURL); + std::string sign_out_page_url = + setting_page_url + std::string(chrome::kSignOutSubPage); + if (selected_index > 0 && + tab.navigations[selected_index].virtual_url().spec() == + sign_out_page_url && + tab.navigations[selected_index - 1].virtual_url().spec() == + setting_page_url) { + return selected_index - 1; + } + + return selected_index; +}
The CQ bit was checked by zmin@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from sky@chromium.org, dbeam@chromium.org Link to the patchset: https://codereview.chromium.org/2493573002/#ps100001 (title: "rebase from master")
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
Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by zmin@chromium.org
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.
Description was changed from ========== Make sure that the browser will always restore settings page instead of sign out page after user sign out and sign in again with force sign in enabled. BUG=642059 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ========== to ========== Make sure that the browser will always restore settings page instead of sign out page after user sign out and sign in again with force sign in enabled. BUG=642059 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ==========
Message was sent while issue was closed.
Committed patchset #5 (id:100001)
Message was sent while issue was closed.
Description was changed from ========== Make sure that the browser will always restore settings page instead of sign out page after user sign out and sign in again with force sign in enabled. BUG=642059 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ========== to ========== Make sure that the browser will always restore settings page instead of sign out page after user sign out and sign in again with force sign in enabled. BUG=642059 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation Committed: https://crrev.com/be19af93c39dc51d3dddf65950869f98d54338e3 Cr-Commit-Position: refs/heads/master@{#432251} ==========
Message was sent while issue was closed.
Patchset 5 (id:??) landed as https://crrev.com/be19af93c39dc51d3dddf65950869f98d54338e3 Cr-Commit-Position: refs/heads/master@{#432251} |