|
|
Chromium Code Reviews|
Created:
8 years, 2 months ago by Joe Thomas Modified:
8 years, 1 month ago CC:
chromium-reviews, Aaron Boodman, mihaip-chromium-reviews_chromium.org Base URL:
http://git.chromium.org/chromium/src.git@master Visibility:
Public. |
DescriptionIncognito-allowed package apps produce duplicate items in context menu
Clean-up all context menu items created for 'incognito' 'split' mode
while destroying incognito profile.
Patch from Joe Thomas <mhx348@motorola.com>.
BUG=138487
TEST=As mentioned in the bug report
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=165029
Patch Set 1 #Patch Set 2 : unittest added #
Total comments: 8
Patch Set 3 : Review-comments incorporated #Patch Set 4 : BrowserTest Added #
Total comments: 1
Patch Set 5 : Review comments incorporated #
Total comments: 2
Patch Set 6 : nit fixed #Patch Set 7 : fixed unittest #
Messages
Total messages: 34 (0 generated)
This seems reasonable overall. Can you please add a browser test to verify the change? Also, what happens when you uncheck the "incognito" checkbox on the chrome://extensions page? Do we get a EXTENSION_UNLOADED notification followed by a EXTENSION_LOADED notification?
Thanks for the review. On 2012/10/24 00:21:10, Antony Sargent wrote: > This seems reasonable overall. Can you please add a browser test to verify the > change? Done. > > Also, what happens when you uncheck the "incognito" checkbox on the > chrome://extensions page? Do we get a EXTENSION_UNLOADED notification followed > by a EXTENSION_LOADED notification? Yes, there is a NOTIFICATION_EXTENSION_UNLOADED notification followed by NOTIFICATION_EXTENSION_LOADED when we uncheck the "Allow in Incognito" checkbox.
@asargent: Could you please review the patch again.? Thanks Joe
LGTM - want me to hit the commit queue button for you?
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/MHX348@motorola.com/11226037/4001
Presubmit check for 11226037-4001 failed and returned exit status 1.
Running presubmit commit checks ...
** Presubmit ERRORS **
Missing LGTM from an OWNER for files in these directories:
chrome/browser/profiles
Presubmit checks took 2.5s to calculate.
On 2012/10/25 17:49:31, Antony Sargent wrote: > LGTM - want me to hit the commit queue button for you? Thanks for the review. I just did it. :)
@sail: Could you please review chrome/browser/profiles ? Thanks Joe
https://codereview.chromium.org/11226037/diff/4001/chrome/browser/profiles/of... File chrome/browser/profiles/off_the_record_profile_impl.cc (right): https://codereview.chromium.org/11226037/diff/4001/chrome/browser/profiles/of... chrome/browser/profiles/off_the_record_profile_impl.cc:128: MaybeSendDestroyedNotification(); Hm.. do you really need to change profiles code to fix this? Can't you listen to NOTIFICATION_PROFILE_DESTROYED? https://codereview.chromium.org/11226037/diff/4001/chrome/browser/profiles/of... chrome/browser/profiles/off_the_record_profile_impl.cc:138: extension_service->menu_manager()->RemoveAllIncognitoContextItems(); This needs a test (something that doesn't pass without your patch and passes with your patch).
https://codereview.chromium.org/11226037/diff/4001/chrome/browser/profiles/of... File chrome/browser/profiles/off_the_record_profile_impl.cc (right): https://codereview.chromium.org/11226037/diff/4001/chrome/browser/profiles/of... chrome/browser/profiles/off_the_record_profile_impl.cc:128: MaybeSendDestroyedNotification(); On 2012/10/25 19:22:00, sail wrote: > Hm.. do you really need to change profiles code to fix this? Can't you listen to > NOTIFICATION_PROFILE_DESTROYED? MenuManager for Extensions is owned by the ExtensionService and it is constructed with Normal Profile instance. There is no separate MenuManager instance created for incognito profile. So MenuManager will not get notified for Incognito profile destruction. This is a special case in which manifest.json of extension contains "incognito" defined as "split". https://codereview.chromium.org/11226037/diff/4001/chrome/browser/profiles/of... chrome/browser/profiles/off_the_record_profile_impl.cc:138: extension_service->menu_manager()->RemoveAllIncognitoContextItems(); On 2012/10/25 19:22:00, sail wrote: > This needs a test (something that doesn't pass without your patch and passes > with your patch). I already added a unit test for the new function that I created in menu_manager_unittest.cc. Testing the complete use case requires creating and destroying incognito window multiple times and navigate through the context menu items of incognito window. I am not quite sure how to do that. Do we have any similar testcase that I can look into?
https://codereview.chromium.org/11226037/diff/4001/chrome/browser/profiles/of... File chrome/browser/profiles/off_the_record_profile_impl.cc (right): https://codereview.chromium.org/11226037/diff/4001/chrome/browser/profiles/of... chrome/browser/profiles/off_the_record_profile_impl.cc:128: MaybeSendDestroyedNotification(); On 2012/10/25 19:49:42, Joe Thomas wrote: > On 2012/10/25 19:22:00, sail wrote: > > Hm.. do you really need to change profiles code to fix this? Can't you listen > to > > NOTIFICATION_PROFILE_DESTROYED? > > MenuManager for Extensions is owned by the ExtensionService and it is > constructed with Normal Profile instance. There is no separate MenuManager > instance created for incognito profile. So MenuManager will not get notified for > Incognito profile destruction. This is a special case in which manifest.json of > extension contains "incognito" defined as "split". This isn't idea. Simply adding every feature into profiles/* won't scale. It seems like adding extra code to observer the incognito notifications shouldn't be that hard. If you really can't add it as a part of this CL then please file a bug to do it separate and put a TODO here. https://codereview.chromium.org/11226037/diff/4001/chrome/browser/profiles/of... chrome/browser/profiles/off_the_record_profile_impl.cc:138: extension_service->menu_manager()->RemoveAllIncognitoContextItems(); On 2012/10/25 19:49:42, Joe Thomas wrote: > On 2012/10/25 19:22:00, sail wrote: > > This needs a test (something that doesn't pass without your patch and passes > > with your patch). > > I already added a unit test for the new function that I created in > menu_manager_unittest.cc. > > Testing the complete use case requires creating and destroying incognito window > multiple times and navigate through the context menu items of incognito window. > I am not quite sure how to do that. Do we have any similar testcase that I can > look into? Take a look at profile_browsertest.cc and profile_manager_browsertest.cc. It's fairly easy to create new incognito windows from browser tests.
@Antony Sargent: Could you please review chrome/browser/extensions/extension_process_manager.cc? I moved the code in off_the_record_profile_impl.cc to here. Thanks Joe https://codereview.chromium.org/11226037/diff/4001/chrome/browser/profiles/of... File chrome/browser/profiles/off_the_record_profile_impl.cc (right): https://codereview.chromium.org/11226037/diff/4001/chrome/browser/profiles/of... chrome/browser/profiles/off_the_record_profile_impl.cc:128: MaybeSendDestroyedNotification(); On 2012/10/25 19:56:14, sail wrote: > On 2012/10/25 19:49:42, Joe Thomas wrote: > > On 2012/10/25 19:22:00, sail wrote: > > > Hm.. do you really need to change profiles code to fix this? Can't you > listen > > to > > > NOTIFICATION_PROFILE_DESTROYED? > > > > MenuManager for Extensions is owned by the ExtensionService and it is > > constructed with Normal Profile instance. There is no separate MenuManager > > instance created for incognito profile. So MenuManager will not get notified > for > > Incognito profile destruction. This is a special case in which manifest.json > of > > extension contains "incognito" defined as "split". > > This isn't idea. Simply adding every feature into profiles/* won't scale. It > seems like adding extra code to observer the incognito notifications shouldn't > be that hard. > > If you really can't add it as a part of this CL then please file a bug to do it > separate and put a TODO here. I moved this code out of chrome/browser/profile* to extension_process_manager.cc.
This code still requires a test (as per my pervious comment). https://codereview.chromium.org/11226037/diff/4001/chrome/browser/profiles/of... File chrome/browser/profiles/off_the_record_profile_impl.cc (right): https://codereview.chromium.org/11226037/diff/4001/chrome/browser/profiles/of... chrome/browser/profiles/off_the_record_profile_impl.cc:128: MaybeSendDestroyedNotification(); On 2012/10/26 03:49:54, Joe Thomas wrote: > On 2012/10/25 19:56:14, sail wrote: > > On 2012/10/25 19:49:42, Joe Thomas wrote: > > > On 2012/10/25 19:22:00, sail wrote: > > > > Hm.. do you really need to change profiles code to fix this? Can't you > > listen > > > to > > > > NOTIFICATION_PROFILE_DESTROYED? > > > > > > MenuManager for Extensions is owned by the ExtensionService and it is > > > constructed with Normal Profile instance. There is no separate MenuManager > > > instance created for incognito profile. So MenuManager will not get notified > > for > > > Incognito profile destruction. This is a special case in which manifest.json > > of > > > extension contains "incognito" defined as "split". > > > > This isn't idea. Simply adding every feature into profiles/* won't scale. It > > seems like adding extra code to observer the incognito notifications shouldn't > > be that hard. > > > > If you really can't add it as a part of this CL then please file a bug to do > it > > separate and put a TODO here. > > I moved this code out of chrome/browser/profile* to > extension_process_manager.cc. Thanks.
On 2012/10/26 04:36:30, sail wrote: > This code still requires a test (as per my pervious comment). > Apologies if I am wrong, I am still not convinced that the code change requires a browser test covering the entire usecase. I already added a unit test for the new method that I introduced. I went through the browser tests and I don't see a new browser test for each and every bug. I am new to chromium, please correct me if I am wrong, and I can add the test if necessary.
On 2012/10/26 04:36:30, sail wrote: > This code still requires a test (as per my pervious comment). > Apologies if I am wrong, I am still not convinced that the code change requires a browser test covering the entire usecase. I already added a unit test for the new method that I introduced. I went through the browser tests and I don't see a new browser test for each and every bug. I am new to chromium, please correct me if I am wrong, and I can add the test if necessary.
On 2012/10/26 16:00:42, Joe Thomas wrote: > On 2012/10/26 04:36:30, sail wrote: > > This code still requires a test (as per my pervious comment). > > > > Apologies if I am wrong, I am still not convinced that the code change requires > a browser test covering the entire usecase. I already added a unit test for the > new method that I introduced. > > I went through the browser tests and I don't see a new browser test for each and > every bug. I am new to chromium, please correct me if I am wrong, and I can add > the test if necessary. Fixing a bug without a test is not very helpful. Most likely this will regress again and we'll have to fix it all over again. A test should be a part of each and every bug fix. Whether the test is a unit test or a browser test is irrelevant. Your unit test only tests the utility function you've added. You haven't added a test to verify that the bug is actually fixed.
Added Browser test. @Antony Sargent: Could you please review the CL again? Thanks Joe
On 2012/10/26 17:14:05, sail wrote: > On 2012/10/26 16:00:42, Joe Thomas wrote: > > On 2012/10/26 04:36:30, sail wrote: > > > This code still requires a test (as per my pervious comment). > > > > > > > Apologies if I am wrong, I am still not convinced that the code change > requires > > a browser test covering the entire usecase. I already added a unit test for > the > > new method that I introduced. > > > > I went through the browser tests and I don't see a new browser test for each > and > > every bug. I am new to chromium, please correct me if I am wrong, and I can > add > > the test if necessary. > > Fixing a bug without a test is not very helpful. Most likely this will regress > again and we'll have to fix it all over again. > > A test should be a part of each and every bug fix. Whether the test is a unit > test or a browser test is irrelevant. > > Your unit test only tests the utility function you've added. You haven't added a > test to verify that the bug is actually fixed. Thanks sail for the clarification. I added a browser test. Please review.
Thanks for the test. LGTM
On 2012/10/29 20:55:06, sail wrote: > Thanks for the test. LGTM Thanks for the review. Do I need another LGTM from Antony Sargent to hit the commit button as I modified extension_process_manager.cc after his last review?
On 2012/10/29 20:58:29, Joe Thomas wrote: > On 2012/10/29 20:55:06, sail wrote: > > Thanks for the test. LGTM > > Thanks for the review. Do I need another LGTM from Antony Sargent to hit the > commit button as I modified extension_process_manager.cc after his last review? I'd wait for a LGTM from an extensions/* OWNER. Your change to extension_process_manager.cc looks good to me but I don't know all the details about how that code works.
@Antony Sargent: Could you please review extension_process_manager.cc? Thanks Joe
https://codereview.chromium.org/11226037/diff/18001/chrome/browser/extensions... File chrome/browser/extensions/extension_process_manager.cc (right): https://codereview.chromium.org/11226037/diff/18001/chrome/browser/extensions... chrome/browser/extensions/extension_process_manager.cc:626: Profile* profile = content::Source<Profile>(source).ptr(); Note that only the incognito profile's ExtensionProcessManager will see this event from the incognito profile. So you could do this cleanup in the destructor of IncognitoExtensionProcessManager instead, since it has the same lifetime as the incognito profile. This is probably okay for now (to fix this bug), but there's definitely a modularity issue, since this code isn't related to the ExtensionProcessManager, but only to the lifetime of the incognito profile. Can you add a TODO(yoz): This cleanup code belongs in the MenuManager.
LGTM for extension_process_manager, but please fix nit before submitting https://codereview.chromium.org/11226037/diff/18003/chrome/browser/extensions... File chrome/browser/extensions/extension_process_manager.cc (right): https://codereview.chromium.org/11226037/diff/18003/chrome/browser/extensions... chrome/browser/extensions/extension_process_manager.cc:826: IncognitoExtensionProcessManager::~IncognitoExtensionProcessManager() { Please keep the function definitions in the same order as the declarations. (You can also move ExtensionProcessManager::ViewSet to a more correct location in this file.)
https://codereview.chromium.org/11226037/diff/18003/chrome/browser/extensions... File chrome/browser/extensions/extension_process_manager.cc (right): https://codereview.chromium.org/11226037/diff/18003/chrome/browser/extensions... chrome/browser/extensions/extension_process_manager.cc:826: IncognitoExtensionProcessManager::~IncognitoExtensionProcessManager() { On 2012/10/29 22:23:40, Yoyo Zhou wrote: > Please keep the function definitions in the same order as the declarations. (You > can also move ExtensionProcessManager::ViewSet to a more correct location in > this file.) Done. Apparently there are other functions in ExtensionProcessManager and IncognitoExtensionProcessManager which are out-of-order. I will create a CL to correct that once this lands.
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/MHX348@motorola.com/11226037/27001
Retried try job too often for step(s) browser_tests
On 2012/10/29 23:46:34, I haz the power (commit-bot) wrote: > Retried try job too often for step(s) browser_tests There is no ExtensionService created while executing OffTheRecordProfileImplTest.GetHostZoomMap unittest and so it crashed in the IncognitoExtensionProcessManager destructor. Added a null check for ExtensionService in the IncognitoExtensionProcessManager destructor. @Yoyo Zhou: Could you please review it again? Thanks.
LGTM
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/MHX348@motorola.com/11226037/21006
Change committed as 165029 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
