Fix <rdar://problem/5214504> No way to change WebPreferences defaults (all...
authoraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Aug 2007 21:24:28 +0000 (21:24 +0000)
committeraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Aug 2007 21:24:28 +0000 (21:24 +0000)
commitfd99e411267f03f69f048867b78351cbdaf24028
tree484ad60d801969aa4557e35cad3e5ececfecc0b5
parent1f859b56afa11f02edaf6292688516e80bf06098
    Fix <rdar://problem/5214504> No way to change WebPreferences defaults (all preferences get written to disk)

        We now only write to disk values that have been explicitly set, and
        never write any default values.

        This is not enough, however, as anyone who has used WebKit prior to
        this change will have the default values sitting in their preferences
        plist on disk. To remedy this, we perform a one-time removal of any
        key-value pairs that match a pair in the defaults dictionary.

        Reviewed by Steve, John, Ada, and Darin.

        * WebPreferenceKeysPrivate.h: Added new key to ensure we only remove
        the defaults once.
        * WebPreferences.cpp:
        (WebPreferences::initializeDefaultSettings): Renamed from initialize, and
        made sure we only set up the defaults dictionary once. Now that the
        defaults dictionary is never modified after creation, we don't need to
        check whether the keys are already present.
        (WebPreferences::setStringValue): Don't modify the defaults dictionary.
        (WebPreferences::setIntegerValue): Ditto.
        (WebPreferences::setBoolValue): Ditto.
        (WebPreferences::save): Write out the user's preferences, not the defaults.
        (WebPreferences::load):
           - Removed gotos and early declarations now that we're using
             RetainPtr everywhere.
           - Initialize m_privatePrefs with an empty dictionary if we didn't
             read in a plist.
           - Call migrateDefaultSettingsFromSafari3Beta after loading.
        (WebPreferences::migrateDefaultSettingsFromSafari3Beta): Added.
        (WebPreferences::removeValuesMatchingDefaultSettings): Added.
        (WebPreferences::initWithIdentifier): Don't initialize m_privatePrefs
        -- load() does this now.
        * WebPreferences.h: Updated/added declarations.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@25074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKit/win/ChangeLog
WebKit/win/WebPreferenceKeysPrivate.h
WebKit/win/WebPreferences.cpp
WebKit/win/WebPreferences.h