Changeset 169357 in webkit


Ignore:
Timestamp:
May 26, 2014 11:01:45 AM (10 years ago)
Author:
weinig@apple.com
Message:

[WebKit2] Add better default preferences while keeping backward compatibility for the C-SPI
https://bugs.webkit.org/show_bug.cgi?id=133289

Reviewed by Anders Carlsson.

  • Shared/WebPreferencesStore.h:

Change a few defaults:

  • PluginsEnabled -> false
  • JavaEnabled -> false
  • JavaEnabledForLocalFiles -> false
  • StorageBlockingPolicy -> BlockThirdPartyStorage
  • UIProcess/API/C/WKPreferences.cpp:

(WKPreferencesCreate):
(WKPreferencesCreateWithIdentifier):

  • UIProcess/WebPageGroup.cpp:

(WebKit::WebPageGroup::WebPageGroup):
Switch to using WebPreferences::createWithLegacyDefaults().

  • UIProcess/WebPreferences.cpp:

(WebKit::WebPreferences::create):
(WebKit::WebPreferences::createWithLegacyDefaults):

  • UIProcess/WebPreferences.h:

Move create functions to the cpp file and add createWithLegacyDefaults() which keeps
the old defaults;

  • UIProcess/API/C/WKPreferencesRef.h:

Fix the comment.

  • UIProcess/API/Cocoa/WKPreferences.h:

Update the comment to reflect the new defaults.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::updatePreferences):
Unconditionally set setShouldDispatchJavaScriptWindowOnErrorEvents() to true. This setting only
exists for legacy WebKit.

Location:
trunk/Source/WebKit2
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r169356 r169357  
     12014-05-26  Sam Weinig  <sam@webkit.org>
     2
     3        [WebKit2] Add better default preferences while keeping backward compatibility for the C-SPI
     4        https://bugs.webkit.org/show_bug.cgi?id=133289
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * Shared/WebPreferencesStore.h:
     9        Change a few defaults:
     10        - PluginsEnabled -> false
     11        - JavaEnabled -> false
     12        - JavaEnabledForLocalFiles -> false
     13        - StorageBlockingPolicy -> BlockThirdPartyStorage
     14
     15        * UIProcess/API/C/WKPreferences.cpp:
     16        (WKPreferencesCreate):
     17        (WKPreferencesCreateWithIdentifier):
     18        * UIProcess/WebPageGroup.cpp:
     19        (WebKit::WebPageGroup::WebPageGroup):
     20        Switch to using WebPreferences::createWithLegacyDefaults().
     21
     22        * UIProcess/WebPreferences.cpp:
     23        (WebKit::WebPreferences::create):
     24        (WebKit::WebPreferences::createWithLegacyDefaults):
     25        * UIProcess/WebPreferences.h:
     26        Move create functions to the cpp file and add createWithLegacyDefaults() which keeps
     27        the old defaults;
     28
     29        * UIProcess/API/C/WKPreferencesRef.h:
     30        Fix the comment.
     31
     32        * UIProcess/API/Cocoa/WKPreferences.h:
     33        Update the comment to reflect the new defaults.
     34
     35        * WebProcess/WebPage/WebPage.cpp:
     36        (WebKit::WebPage::updatePreferences):
     37        Unconditionally set setShouldDispatchJavaScriptWindowOnErrorEvents() to true. This setting only
     38        exists for legacy WebKit.
     39
    1402014-05-26  Dan Bernstein  <mitz@apple.com>
    241
  • trunk/Source/WebKit2/Shared/WebPreferencesStore.h

    r169321 r169357  
    107107    macro(LoadsImagesAutomatically, loadsImagesAutomatically, Bool, bool, true) \
    108108    macro(LoadsSiteIconsIgnoringImageLoadingPreference, loadsSiteIconsIgnoringImageLoadingPreference, Bool, bool, false) \
    109     macro(PluginsEnabled, pluginsEnabled, Bool, bool, true) \
    110     macro(JavaEnabled, javaEnabled, Bool, bool, true) \
    111     macro(JavaEnabledForLocalFiles, javaEnabledForLocalFiles, Bool, bool, true) \
     109    macro(PluginsEnabled, pluginsEnabled, Bool, bool, false) \
     110    macro(JavaEnabled, javaEnabled, Bool, bool, false) \
     111    macro(JavaEnabledForLocalFiles, javaEnabledForLocalFiles, Bool, bool, false) \
    112112    macro(OfflineWebApplicationCacheEnabled, offlineWebApplicationCacheEnabled, Bool, bool, false) \
    113113    macro(LocalStorageEnabled, localStorageEnabled, Bool, bool, true) \
     
    244244    macro(InspectorAttachedWidth, inspectorAttachedWidth, UInt32, uint32_t, 750) \
    245245    macro(InspectorAttachmentSide, inspectorAttachmentSide, UInt32, uint32_t, 0) \
    246     macro(StorageBlockingPolicy, storageBlockingPolicy, UInt32, uint32_t, WebCore::SecurityOrigin::AllowAllStorage) \
     246    macro(StorageBlockingPolicy, storageBlockingPolicy, UInt32, uint32_t, WebCore::SecurityOrigin::BlockThirdPartyStorage) \
    247247    \
    248248
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp

    r168978 r169357  
    4444WKPreferencesRef WKPreferencesCreate()
    4545{
    46     RefPtr<WebPreferences> preferences = WebPreferences::create(String(), "WebKit2.");
     46    RefPtr<WebPreferences> preferences = WebPreferences::createWithLegacyDefaults(String(), "WebKit2.");
    4747    return toAPI(preferences.release().leakRef());
    4848}
     
    5050WKPreferencesRef WKPreferencesCreateWithIdentifier(WKStringRef identifierRef)
    5151{
    52     RefPtr<WebPreferences> preferences = WebPreferences::create(toWTFString(identifierRef), "WebKit2.");
     52    RefPtr<WebPreferences> preferences = WebPreferences::createWithLegacyDefaults(toWTFString(identifierRef), "WebKit2.");
    5353    return toAPI(preferences.release().leakRef());
    5454}
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRef.h

    r168541 r169357  
    217217WK_EXPORT bool WKPreferencesGetShouldRespectImageOrientation(WKPreferencesRef preferencesRef);
    218218
    219 // Defaults to false
     219// Defaults to kWKAllowAllStorage
    220220WK_EXPORT void WKPreferencesSetStorageBlockingPolicy(WKPreferencesRef preferencesRef, WKStorageBlockingPolicy policy);
    221221WK_EXPORT WKStorageBlockingPolicy WKPreferencesGetStorageBlockingPolicy(WKPreferencesRef preferencesRef);
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.h

    r169323 r169357  
    8080
    8181#if !TARGET_OS_IPHONE
    82 /*! @abstract Whether Java is enabled. Defaults to YES.
     82/*! @abstract Whether Java is enabled. Defaults to NO.
    8383 */
    8484@property (nonatomic, getter=isJavaEnabled) BOOL javaEnabled;
    8585
    86 /*! abstract Whether plug-ins are enabled. Defaults to YES.
     86/*! abstract Whether plug-ins are enabled. Defaults to NO.
    8787 */
    8888@property (nonatomic, getter=arePlugInsEnabled) BOOL plugInsEnabled;
  • trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp

    r166553 r169357  
    8585WebPageGroup::WebPageGroup(const String& identifier, bool visibleToInjectedBundle, bool visibleToHistoryClient)
    8686    : m_data(pageGroupData(identifier, visibleToInjectedBundle, visibleToHistoryClient))
    87     , m_preferences(WebPreferences::create(m_data.identifer, ".WebKit2"))
     87    , m_preferences(WebPreferences::createWithLegacyDefaults(m_data.identifer, ".WebKit2"))
    8888{
    8989    webPageGroupMap().set(m_data.pageGroupID, this);
  • trunk/Source/WebKit2/UIProcess/WebPreferences.cpp

    r166553 r169357  
    3636// Instead of tracking private browsing state as a boolean preference, we should let the client provide storage sessions explicitly.
    3737static unsigned privateBrowsingPageCount;
     38
     39PassRefPtr<WebPreferences> WebPreferences::create(const String& identifier, const String& keyPrefix)
     40{
     41    return adoptRef(new WebPreferences(identifier, keyPrefix));
     42}
     43
     44PassRefPtr<WebPreferences> WebPreferences::createWithLegacyDefaults(const String& identifier, const String& keyPrefix)
     45{
     46    RefPtr<WebPreferences> preferences = adoptRef(new WebPreferences(identifier, keyPrefix));
     47    preferences->m_store.setOverrideDefaultsBoolValueForKey(WebPreferencesKey::javaEnabledKey(), true);
     48    preferences->m_store.setOverrideDefaultsBoolValueForKey(WebPreferencesKey::javaEnabledForLocalFilesKey(), true);
     49    preferences->m_store.setOverrideDefaultsBoolValueForKey(WebPreferencesKey::pluginsEnabledKey(), true);
     50    preferences->m_store.setOverrideDefaultsUInt32ValueForKey(WebPreferencesKey::storageBlockingPolicyKey(), WebCore::SecurityOrigin::AllowAllStorage);
     51    return preferences.release();
     52}
    3853
    3954WebPreferences::WebPreferences(const String& identifier, const String& keyPrefix)
  • trunk/Source/WebKit2/UIProcess/WebPreferences.h

    r166553 r169357  
    4444class WebPreferences : public API::ObjectImpl<API::Object::Type::Preferences> {
    4545public:
    46     static PassRefPtr<WebPreferences> create(const String& identifier, const String& keyPrefix)
    47     {
    48         return adoptRef(new WebPreferences(identifier, keyPrefix));
    49     }
     46    static PassRefPtr<WebPreferences> create(const String& identifier, const String& keyPrefix);
     47    static PassRefPtr<WebPreferences> createWithLegacyDefaults(const String& identifier, const String& keyPrefix);
    5048
    5149    virtual ~WebPreferences();
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r169332 r169357  
    27402740    settings.setEnableInheritURIQueryComponent(store.getBoolValueForKey(WebPreferencesKey::enableInheritURIQueryComponentKey()));
    27412741
     2742    settings.setShouldDispatchJavaScriptWindowOnErrorEvents(true);
     2743
    27422744    if (store.getBoolValueForKey(WebPreferencesKey::pageVisibilityBasedProcessSuppressionEnabledKey()))
    27432745        m_processSuppressionDisabledByWebPreference.stop();
Note: See TracChangeset for help on using the changeset viewer.