DescriptionThe goal of this patch is to ensure that Chrome maintains the order in which extensions apply their preferences between restarts. This may be an issue if two extensions overwrite each others preferences.
ExtensionPrefs has been extended to store and retrieve an ordered list of extension IDs, that correspond to the precedences of extensions. Extensions that appear further to the end of the list may override settings of extension closer to the beginning of the list.
ExtensionPrefStore has been extended to use this storage capability and maintain the precedences according to the installation order. Newly installed extensions have a higher precedence than previously installed extensions. Upon restart of Chrome, the precedences are preserved.
There is currently no code that uses the ExtensionPrefStore except for the unfinished Proxy API. This makes manual testing difficult.
This is an alternative implementation to issue 4111015, http://codereview.chromium.org/4111015/show
The difference: The datastructure of extension_stack_ has been modified. The key is no longer an |Extension *| but now an extension_id. This enables a simpler approach to achieve deterministic extension precedences.
The extension_stack_ is lazily initialized the first time an extension preference is registered. At that time we put empty dictionaries in the right order onto the extension_stack_ (right order = respecting the precedences). This guarantees the precedence and does not require sorting the extension_stack_ as in CL 4111015.
Advantage of this approach:
- simpler (no sorting)
- simpler to extend so that previously winning prefs can be restored
Disadvantage of this approach:
- comparison of extension ids is more expensive than comparison of pointers, but this should not be performance critical anyway
Contributed by battre@google.com
BUG=50726
TEST=none
Patch Set 1 #Patch Set 2 : Fix whitespace #
Total comments: 7
Patch Set 3 : Addressed review comments (uniqueness of IDs and use of DCHECK) #Patch Set 4 : Rebase to trunk #Patch Set 5 : whitespaces #
Messages
Total messages: 14 (0 generated)
|