-
Notifications
You must be signed in to change notification settings - Fork 879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix widevine install prompt is shown after using new profiles #3959
Conversation
6b1fa2f
to
84d531f
Compare
72d9fef
to
1dc70e5
Compare
2be1eae
to
5ddc33c
Compare
5ddc33c
to
b38e020
Compare
b38e020
to
d82a4ff
Compare
d82a4ff
to
19bba9f
Compare
CI looks good with current commit. So, added skip tag. |
19bba9f
to
a63bb16
Compare
browser/brave_local_state_prefs.cc
Outdated
@@ -31,6 +32,10 @@ | |||
#include "brave/components/p3a/p3a_core_metrics.h" | |||
#endif // !defined(OS_ANDROID) | |||
|
|||
#if BUILDFLAG(ENABLE_WIDEVINE_CDM_COMPONENT) || BUILDFLAG(BUNDLE_WIDEVINE_CDM) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should just be ENABLE_WIDEVINE
Install prompt is displayed if widevine is opt opted in by user and user doesn't choose don't ask option of it. Widevine cdm lib is loaded into cdm utility process after it installed. And it is browser widely used not just for specific profile. However, Brave has prompted widevine permission prompt when user loads contents site(ex, netflix) in newly created profile. If Widevine cdm lib is already installed by any profile, Brave should not display it again because cdm lib is already used. To fix this, two kWidevineOptedIn/kWidevineInstalledVersion are migrated from profile prefs to local state. When migration is needed, firstly active profile is used to get existing pref values. There is one more Widevine related pref. It's kAskWidevineInstall. It would be good to migrate to local prefs also. but left as-is in profile prefs also seems fine. After Widevine is installed that prefs doesn't have much meaning and if not just click once to dont ask is sufficient. Also, it is convinient to implement settings option with profile prefs.
cba6c6e
to
28eff92
Compare
Add WidevinePrefsMigrationTest.PrefMigrationTest for prefs migration test.
28eff92
to
dec8edf
Compare
Last CI build was success and pushed one more commit for just adding comments. |
|
||
using WidevinePrefsMigrationTest = InProcessBrowserTest; | ||
|
||
IN_PROC_BROWSER_TEST_F(WidevinePrefsMigrationTest, PrefMigrationTest) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to add a PRE_PrefMigrationTest
and set local_state to default value and also set profile value for kWidevineOptedIn
and kWidevineInstalledVersion
to verify the migrated values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that scenario at first.
But, local_state is not the default value at the second launching.(Of course, cleared local state in the first launching).
Not sure why it happens. I'm trying again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, local state seems not consistent during the spanning tests.
In the second launching, it's state is not the last state of first browser launching.
profile prefs shows consistent state but not local state during the spanning test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local state is persisted but not persisted after clearing prefs(ClearPref()
).
At second test, local state has the value before the clearing. I expected it has default value because ClearePref()
is called but it's not default value at second test.
So, testing is done by explicitly calling MigrateWidevinePrefs()
instead of spanning test.
29e834e
to
0cdf603
Compare
local state is persisted but not persisted after clearing prefs in the spanning test. At second test, local state has the value before the clearing. I expected it has default value because ClearePref() is called but it's not default value at second test. So, testing is done by explicitly calling MigrateWidevinePrefs() instead of spanning test.
0cdf603
to
1188431
Compare
Fix brave/brave-browser#6747
Install prompt is displayed if widevine is opt opted in by user and user
doesn't choose don't ask option of it.
Widevine cdm lib is loaded into cdm utility process after it installed.
And it is browser widely used not just for specific profile.
However, Brave has prompted widevine permission prompt when user loads
contents site(ex, netflix) in newly created profile.
If Widevine cdm lib is already installed by any profile, Brave should not
display it again because cdm lib is already used.
To fix this, two kWidevineOptedIn/kWidevineInstalledVersion are migrated
from profile prefs to local state.
When migration is needed, firstly active profile is used to get existing
pref values.
There is one more Widevine related pref. It's
kAskWidevineInstall
.It would be good to migrate
kAskWidevineInstall
to local prefs also.But left as-is in profile prefs also seems fine.
After Widevine is installed that prefs doesn't have much meaning and if not just click once to dont ask is sufficient. Also, it is convinient to implement settings option with profile prefs.
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
yarn test brave_browser_tests --filter=*Widevine*
yarn test brave_unit_tests --filter=*Widevine*
Migration test steps
Reviewer Checklist:
After-merge Checklist:
changes has landed on.