Changeset 146664 in webkit


Ignore:
Timestamp:
Mar 22, 2013 3:19:52 PM (11 years ago)
Author:
ggaren@apple.com
Message:

Added a setting for whether JavaScript markup is enabled
https://bugs.webkit.org/show_bug.cgi?id=112999

Reviewed by Maciej Stachowiak.

This setting is useful for clients that want protection from script
injection attacks.

../WebCore:

  • page/Settings.h:

(Settings): Clarified which clients should call canExecuteScripts().

  • page/Settings.in: Added the new setting.

../WebKit2:

  • Shared/WebPreferencesStore.h:
  • UIProcess/API/C/WKPreferences.cpp:

(WKPreferencesGetJavaScriptMarkupEnabled):
(WKPreferencesSetJavaScriptMarkupEnabled):
(WKPreferencesGetJavaScriptEnabled):

  • UIProcess/API/C/WKPreferences.h:
  • UIProcess/API/mac/WKBrowsingContextGroup.mm:

(-[WKBrowsingContextGroup allowsJavaScriptMarkup]):
(-[WKBrowsingContextGroup setAllowsJavaScriptMarkup:]):

  • WebProcess/InjectedBundle/InjectedBundle.cpp:

(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::updatePreferences): Plumbed through to API.

Location:
trunk/Source
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r146661 r146664  
     12013-03-21  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Added a setting for whether JavaScript markup is enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=112999
     5
     6        Reviewed by Maciej Stachowiak.
     7
     8        This setting is useful for clients that want protection from script
     9        injection attacks.
     10
     11        * page/Settings.h:
     12        (Settings): Clarified which clients should call canExecuteScripts().
     13
     14        * page/Settings.in: Added the new setting.
     15
    1162013-03-22  Roger Fong  <roger_fong@apple.com>
    217
  • trunk/Source/WebCore/page/Settings.h

    r145003 r146664  
    120120        bool loadsImagesAutomatically() const { return m_loadsImagesAutomatically; }
    121121
     122        // Clients that execute script should call ScriptController::canExecuteScripts()
     123        // instead of this function. ScriptController::canExecuteScripts() checks the
     124        // HTML sandbox, plug-in sandboxing, and other important details.
     125        bool isScriptEnabled() const { return m_isScriptEnabled; }
    122126        void setScriptEnabled(bool);
    123         // Instead of calling isScriptEnabled directly, please consider calling
    124         // ScriptController::canExecuteScripts, which takes things like the
    125         // HTML sandbox attribute into account.
    126         bool isScriptEnabled() const { return m_isScriptEnabled; }
    127127
    128128        SETTINGS_GETTERS_AND_SETTERS
  • trunk/Source/WebCore/page/Settings.in

    r146351 r146664  
    7777developerExtrasEnabled initial=false
    7878javaScriptExperimentsEnabled initial=false
     79scriptMarkupEnabled initial=true
    7980needsSiteSpecificQuirks initial=false
    8081webArchiveDebugModeEnabled initial=false, conditional=WEB_ARCHIVE
  • trunk/Source/WebKit2/ChangeLog

    r146637 r146664  
     12013-03-21  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Added a setting for whether JavaScript markup is enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=112999
     5
     6        Reviewed by Maciej Stachowiak.
     7
     8        This setting is useful for clients that want protection from script
     9        injection attacks.
     10
     11        * Shared/WebPreferencesStore.h:
     12        * UIProcess/API/C/WKPreferences.cpp:
     13        (WKPreferencesGetJavaScriptMarkupEnabled):
     14        (WKPreferencesSetJavaScriptMarkupEnabled):
     15        (WKPreferencesGetJavaScriptEnabled):
     16        * UIProcess/API/C/WKPreferences.h:
     17        * UIProcess/API/mac/WKBrowsingContextGroup.mm:
     18        (-[WKBrowsingContextGroup allowsJavaScriptMarkup]):
     19        (-[WKBrowsingContextGroup setAllowsJavaScriptMarkup:]):
     20        * WebProcess/InjectedBundle/InjectedBundle.cpp:
     21        (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
     22        * WebProcess/WebPage/WebPage.cpp:
     23        (WebKit::WebPage::updatePreferences): Plumbed through to API.
     24
    1252013-03-22  Mario Sanchez Prada  <mario.prada@samsung.com>
    226
  • trunk/Source/WebKit2/Shared/WebPreferencesStore.h

    r145961 r146664  
    5757#define FOR_EACH_WEBKIT_BOOL_PREFERENCE(macro) \
    5858    macro(JavaScriptEnabled, javaScriptEnabled, Bool, bool, true) \
     59    macro(JavaScriptMarkupEnabled, javaScriptMarkupEnabled, Bool, bool, true) \
    5960    macro(LoadsImagesAutomatically, loadsImagesAutomatically, Bool, bool, true) \
    6061    macro(LoadsSiteIconsIgnoringImageLoadingPreference, loadsSiteIconsIgnoringImageLoadingPreference, Bool, bool, false) \
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp

    r145386 r146664  
    7070}
    7171
     72void WKPreferencesSetJavaScriptMarkupEnabled(WKPreferencesRef preferencesRef, bool javaScriptMarkupEnabled)
     73{
     74    toImpl(preferencesRef)->setJavaScriptMarkupEnabled(javaScriptMarkupEnabled);
     75}
     76
     77bool WKPreferencesGetJavaScriptMarkupEnabled(WKPreferencesRef preferencesRef)
     78{
     79    return toImpl(preferencesRef)->javaScriptMarkupEnabled();
     80}
     81
    7282void WKPreferencesSetLoadsImagesAutomatically(WKPreferencesRef preferencesRef, bool loadsImagesAutomatically)
    7383{
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.h

    r144752 r146664  
    5454
    5555// Defaults to true.
     56WK_EXPORT void WKPreferencesSetJavaScriptMarkupEnabled(WKPreferencesRef preferences, bool javaScriptEnabled);
     57WK_EXPORT bool WKPreferencesGetJavaScriptMarkupEnabled(WKPreferencesRef preferences);
     58
     59// Defaults to true.
    5660WK_EXPORT void WKPreferencesSetLoadsImagesAutomatically(WKPreferencesRef preferences, bool loadsImagesAutomatically);
    5761WK_EXPORT bool WKPreferencesGetLoadsImagesAutomatically(WKPreferencesRef preferences);
  • trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.mm

    r144777 r146664  
    7474{
    7575    WKPreferencesSetJavaScriptEnabled(WKPageGroupGetPreferences(self._pageGroupRef), allowsJavaScript);
     76}
     77
     78- (BOOL)allowsJavaScriptMarkup
     79{
     80    return WKPreferencesGetJavaScriptMarkupEnabled(WKPageGroupGetPreferences(self._pageGroupRef));
     81}
     82
     83- (void)setAllowsJavaScriptMarkup:(BOOL)allowsJavaScriptMarkup
     84{
     85    WKPreferencesSetJavaScriptMarkupEnabled(WKPageGroupGetPreferences(self._pageGroupRef), allowsJavaScriptMarkup);
    7686}
    7787
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp

    r145784 r146664  
    212212    macro(WebKitJavaEnabled, JavaEnabled, javaEnabled) \
    213213    macro(WebKitJavaScriptEnabled, ScriptEnabled, javaScriptEnabled) \
     214    macro(WebKitJavaScriptMarkupEnabled, ScriptEnabled, javaScriptEnabled) \
    214215    macro(WebKitLoadSiteIconsKey, LoadsSiteIconsIgnoringImageLoadingSetting, loadsSiteIconsIgnoringImageLoadingPreference) \
    215216    macro(WebKitOfflineWebApplicationCacheEnabled, OfflineWebApplicationCacheEnabled, offlineWebApplicationCacheEnabled) \
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r146551 r146664  
    22692269
    22702270    settings->setScriptEnabled(store.getBoolValueForKey(WebPreferencesKey::javaScriptEnabledKey()));
     2271    settings->setScriptMarkupEnabled(store.getBoolValueForKey(WebPreferencesKey::javaScriptMarkupEnabledKey()));
    22712272    settings->setLoadsImagesAutomatically(store.getBoolValueForKey(WebPreferencesKey::loadsImagesAutomaticallyKey()));
    22722273    settings->setLoadsSiteIconsIgnoringImageLoadingSetting(store.getBoolValueForKey(WebPreferencesKey::loadsSiteIconsIgnoringImageLoadingPreferenceKey()));
Note: See TracChangeset for help on using the changeset viewer.