-
Notifications
You must be signed in to change notification settings - Fork 15.2k
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
refactor: remove base::Value from WebContentsPreferences #30193
Conversation
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 think this is a this is much better than saving things in a dictionary 👍 .
CI failures are unrelated; merging. |
No Release Notes |
Note, this likely breaks @electron/remote, which checks for |
@nornagon I had vacation last week |
Description of Change
This refactors WebContentsPreferences to store its values directly, rather than
keyed by string in a base::DictionaryValue. It also centralizes logic for
default values; callers no longer have to provide a default value. And finally,
it centralizes all parsing logic in web_contents_preferences.cc, instead of
having logic for fetching keys by string scattered around the codebase.
I think this is not yet the best form of WebContentsPreferences. In particular,
the
Merge
method makes me uneasy, but I don't yet fully understand why it isarchitected that way currently. It has to do with webviews.
This refactor is motivated by a desire to change the default for
sandbox
under complex circumstances. The straightforward approach to that (shown
here)
turns out to not work, because the "defaults" are applied at
WebContents-creation time, so by the time
Merge
is called, it is not knowablewhether or not sandboxing was disabled by default at creation, or whether it
was unspecified. This refactor allows us to be more explicit about defaulting
logic.
NB, this slightly changes the value of
WebContents.getLastWebPreferences()
. Previously it included a full copy of thebase::Value
that backed the WebContentsPreferences. Now it only includes specifically those values that we reference in our own code.Checklist
npm test
passesRelease Notes
Notes: none