[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

ap at apple.com ap at apple.com
Wed Dec 22 12:52:43 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 65ffad3fb43738564d400cf765cd44efce1efb7f
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 31 23:13:58 2010 +0000

            Reviewed by Sam Weinig.
    
            https://bugs.webkit.org/show_bug.cgi?id=42195
            <rdar://problem/8186761> WebKitTestRunner needs to support layoutTestController.setXSSAuditorEnabled
    
    LayoutTests:
            * platform/mac-wk2/Skipped: Unskip XSS Auditor tests.
    
    WebKitTools:
            * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
            * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: (WTR::LayoutTestController::setXSSAuditorEnabled):
            * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
            Added setXSSAuditorEnabled, calling through to an WKBundle private method. Calling this method
            makes WebProcess use a different value for this preference than UIProcess thinks it uses.
    
            * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues):
            Reset xssAuditorEnabled. Even though the value doesn't change, this calls through to WebProcess,
            which forgets its override.
    
    WebKit2:
            * Shared/WebPreferencesStore.cpp:
            (WebKit::WebPreferencesStore::WebPreferencesStore): Initialize xssAuditorEnabled.
            (WebKit::WebPreferencesStore::decode): Moved from header, added xssAuditorEnabled.
            (WebKit::WebPreferencesStore::encode): Ditto.
            (WebKit::WebPreferencesStore::overrideXSSAuditorEnabledForTestRunner): Set an override, so
            that decoding a WebPreferencesStore in the process will give the override result. WebProcess
            doesn't hold to WebPreferencesStore, so there are no existing ones to patch.
            (WebKit::WebPreferencesStore::removeTestRunnerOverrides): Remove the override.
    
            * Shared/WebPreferencesStore.h: Added xssAuditorEnabled.
    
            * UIProcess/API/C/WKPreferences.cpp:
            (WKPreferencesSetXSSAuditorEnabled):
            (WKPreferencesGetXSSAuditorEnabled):
            * UIProcess/API/C/WKPreferences.h:
            Added an API method to change xssAuditorEnabled preference.
    
            * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::preferencesDidChange): Added a comment
            explaining how making this method smarter could affect WebKitTestRunner.
    
            * UIProcess/WebPreferences.cpp:
            (WebKit::WebPreferences::setXSSAuditorEnabled):
            (WebKit::WebPreferences::xssAuditorEnabled):
            * UIProcess/WebPreferences.h:
            Implemented xssAuditorEnabled preference accessors.
    
            * WebProcess/InjectedBundle/API/c/WKBundle.cpp: (WKBundleOverrideXSSAuditorEnabledForTestRunner):
            * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
            Added a private methods to temporarily change xssAuditor setting from an injected bundle,
            not notifying UIProcess about the change.
    
            * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideXSSAuditorEnabledForTestRunner):
            * WebProcess/InjectedBundle/InjectedBundle.h:
            Change the setting in existing pages, and override it for future ones.
    
            * WebProcess/WebPage/WebPage.cpp:
            (WebKit::WebPage::WebPage): Take xssAuditorEnabled from preferences store.
            (WebKit::WebPage::preferencesDidChange): If preferences change, forget our override. This only
            happens in WKRT when the next test begins.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66551 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 5be20d0..1aea38a 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,12 @@
+2010-08-31  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=42195
+        <rdar://problem/8186761> WebKitTestRunner needs to support layoutTestController.setXSSAuditorEnabled
+
+        * platform/mac-wk2/Skipped: Unskip XSS Auditor tests.
+
 2010-08-31  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Gavin Barraclough.
diff --git a/LayoutTests/platform/mac-wk2/Skipped b/LayoutTests/platform/mac-wk2/Skipped
index fa9bb8d..a143bb0 100644
--- a/LayoutTests/platform/mac-wk2/Skipped
+++ b/LayoutTests/platform/mac-wk2/Skipped
@@ -825,117 +825,6 @@ svg/text/selection-tripleclick.svg
 svg/zoom/page/zoom-coords-viewattr-01-b.svg
 svg/zoom/text/zoom-coords-viewattr-01-b.svg
 
-
-# WebKitTestRunner needs to support layoutTestController.setXSSAuditorEnabled
-# <https://bugs.webkit.org/show_bug.cgi?id=42195>
-http/tests/security/xssAuditor/anchor-url-dom-write-location-inline-event-null-char.html
-http/tests/security/xssAuditor/anchor-url-dom-write-location-inline-event.html
-http/tests/security/xssAuditor/anchor-url-dom-write-location-javascript-URL.html
-http/tests/security/xssAuditor/anchor-url-dom-write-location.html
-http/tests/security/xssAuditor/base-href-control-char.html
-http/tests/security/xssAuditor/base-href-direct.html
-http/tests/security/xssAuditor/base-href-null-char.html
-http/tests/security/xssAuditor/base-href-safe.html
-http/tests/security/xssAuditor/base-href-safe2.html
-http/tests/security/xssAuditor/base-href-safe3.html
-http/tests/security/xssAuditor/base-href-scheme-relative.html
-http/tests/security/xssAuditor/base-href.html
-http/tests/security/xssAuditor/dom-write-URL.html
-http/tests/security/xssAuditor/dom-write-innerHTML.html
-http/tests/security/xssAuditor/dom-write-location-inline-event.html
-http/tests/security/xssAuditor/dom-write-location-javascript-URL.html
-http/tests/security/xssAuditor/dom-write-location.html
-http/tests/security/xssAuditor/embed-tag-control-char.html
-http/tests/security/xssAuditor/embed-tag-javascript-url.html
-http/tests/security/xssAuditor/embed-tag-null-char.html
-http/tests/security/xssAuditor/embed-tag.html
-http/tests/security/xssAuditor/faux-script1.html
-http/tests/security/xssAuditor/faux-script2.html
-http/tests/security/xssAuditor/faux-script3.html
-http/tests/security/xssAuditor/full-block-base-href.html
-http/tests/security/xssAuditor/full-block-get-from-iframe.html
-http/tests/security/xssAuditor/full-block-iframe-javascript-url.html
-http/tests/security/xssAuditor/full-block-iframe-no-inherit.php
-http/tests/security/xssAuditor/full-block-javascript-link.html
-http/tests/security/xssAuditor/full-block-link-onclick.html
-http/tests/security/xssAuditor/full-block-object-tag.html
-http/tests/security/xssAuditor/full-block-post-from-iframe.html
-http/tests/security/xssAuditor/full-block-script-tag-with-source.html
-http/tests/security/xssAuditor/full-block-script-tag.html
-http/tests/security/xssAuditor/get-from-iframe.html
-http/tests/security/xssAuditor/iframe-javascript-url-twice-url-encode.html
-http/tests/security/xssAuditor/iframe-javascript-url-twice-url-encode2.html
-http/tests/security/xssAuditor/iframe-javascript-url-twice-url-encode3.html
-http/tests/security/xssAuditor/iframe-javascript-url-url-encoded.html
-http/tests/security/xssAuditor/iframe-javascript-url.html
-http/tests/security/xssAuditor/img-onerror-accented-char.html
-http/tests/security/xssAuditor/img-onerror-non-ASCII-char-default-encoding.html
-http/tests/security/xssAuditor/img-onerror-non-ASCII-char.html
-http/tests/security/xssAuditor/img-onerror-non-ASCII-char2-default-encoding.html
-http/tests/security/xssAuditor/img-onerror-non-ASCII-char2.html
-http/tests/security/xssAuditor/img-onerror-tricky.html
-http/tests/security/xssAuditor/inline-event-HTML-entities.html
-http/tests/security/xssAuditor/javascript-link-HTML-entities-control-char.html
-http/tests/security/xssAuditor/javascript-link-HTML-entities-named.html
-http/tests/security/xssAuditor/javascript-link-HTML-entities-null-char.html
-http/tests/security/xssAuditor/javascript-link-HTML-entities.html
-http/tests/security/xssAuditor/javascript-link-ampersand.html
-http/tests/security/xssAuditor/javascript-link-control-char.html
-http/tests/security/xssAuditor/javascript-link-null-char.html
-http/tests/security/xssAuditor/javascript-link-safe.html
-http/tests/security/xssAuditor/javascript-link-url-encoded.html
-http/tests/security/xssAuditor/javascript-link.html
-http/tests/security/xssAuditor/link-onclick-ampersand.html
-http/tests/security/xssAuditor/link-onclick-control-char.html
-http/tests/security/xssAuditor/link-onclick-entities.html
-http/tests/security/xssAuditor/link-onclick-null-char.html
-http/tests/security/xssAuditor/link-onclick.html
-http/tests/security/xssAuditor/link-opens-new-window.html
-http/tests/security/xssAuditor/malformed-HTML.html
-http/tests/security/xssAuditor/malformed-xss-protection-header.html
-http/tests/security/xssAuditor/meta-tag-http-refresh-javascript-url.html
-http/tests/security/xssAuditor/no-protection-script-tag.html
-http/tests/security/xssAuditor/object-embed-tag-control-char.html
-http/tests/security/xssAuditor/object-embed-tag-null-char.html
-http/tests/security/xssAuditor/object-embed-tag.html
-http/tests/security/xssAuditor/object-src-inject.html
-http/tests/security/xssAuditor/object-tag-javascript-url.html
-http/tests/security/xssAuditor/object-tag.html
-http/tests/security/xssAuditor/post-from-iframe.html
-http/tests/security/xssAuditor/property-escape-noquotes-tab-slash-chars.html
-http/tests/security/xssAuditor/property-escape-noquotes.html
-http/tests/security/xssAuditor/property-escape.html
-http/tests/security/xssAuditor/property-inject.html
-http/tests/security/xssAuditor/script-tag-addslashes-backslash.html
-http/tests/security/xssAuditor/script-tag-addslashes-double-quote.html
-http/tests/security/xssAuditor/script-tag-addslashes-null-char.html
-http/tests/security/xssAuditor/script-tag-addslashes-single-quote.html
-http/tests/security/xssAuditor/script-tag-control-char.html
-http/tests/security/xssAuditor/script-tag-convoluted.html
-http/tests/security/xssAuditor/script-tag-entities.html
-http/tests/security/xssAuditor/script-tag-null-char.html
-http/tests/security/xssAuditor/script-tag-open-redirect.html
-http/tests/security/xssAuditor/script-tag-post-control-char.html
-http/tests/security/xssAuditor/script-tag-post-null-char.html
-http/tests/security/xssAuditor/script-tag-post.html
-http/tests/security/xssAuditor/script-tag-redirect.html
-http/tests/security/xssAuditor/script-tag-safe.html
-http/tests/security/xssAuditor/script-tag-safe2.html
-http/tests/security/xssAuditor/script-tag-safe3.html
-http/tests/security/xssAuditor/script-tag-src-redirect-safe.html
-http/tests/security/xssAuditor/script-tag-with-source-control-char.html
-http/tests/security/xssAuditor/script-tag-with-source-double-quote.html
-http/tests/security/xssAuditor/script-tag-with-source-entities.html
-http/tests/security/xssAuditor/script-tag-with-source-no-quote.html
-http/tests/security/xssAuditor/script-tag-with-source-null-char.html
-http/tests/security/xssAuditor/script-tag-with-source-relative-scheme.html
-http/tests/security/xssAuditor/script-tag-with-source-same-host-with-query.html
-http/tests/security/xssAuditor/script-tag-with-source-same-host.html
-http/tests/security/xssAuditor/script-tag-with-source.html
-http/tests/security/xssAuditor/script-tag.html
-http/tests/security/xssAuditor/xss-protection-parsing-01.html
-plugins/js-from-destroy.html
-
 # WebKit2 needs plugins support
 # <https://bugs.webkit.org/show_bug.cgi?id=42196>
 fast/css/acid2-pixel.html
@@ -945,6 +834,7 @@ fast/events/tabindex-focus-blur-all.html
 fast/loader/loadInProgress.html
 http/tests/misc/acid2-pixel.html
 http/tests/misc/acid2.html
+plugins/js-from-destroy.html
 java
 
 # WebKit2 needs layoutTestController.overridePreference
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 7b73784..3af6641 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,50 @@
+2010-08-31  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=42195
+        <rdar://problem/8186761> WebKitTestRunner needs to support layoutTestController.setXSSAuditorEnabled
+
+        * Shared/WebPreferencesStore.cpp:
+        (WebKit::WebPreferencesStore::WebPreferencesStore): Initialize xssAuditorEnabled.
+        (WebKit::WebPreferencesStore::decode): Moved from header, added xssAuditorEnabled.
+        (WebKit::WebPreferencesStore::encode): Ditto.
+        (WebKit::WebPreferencesStore::overrideXSSAuditorEnabledForTestRunner): Set an override, so
+        that decoding a WebPreferencesStore in the process will give the override result. WebProcess
+        doesn't hold to WebPreferencesStore, so there are no existing ones to patch.
+        (WebKit::WebPreferencesStore::removeTestRunnerOverrides): Remove the override.
+
+        * Shared/WebPreferencesStore.h: Added xssAuditorEnabled.
+
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetXSSAuditorEnabled):
+        (WKPreferencesGetXSSAuditorEnabled):
+        * UIProcess/API/C/WKPreferences.h:
+        Added an API method to change xssAuditorEnabled preference.
+
+        * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::preferencesDidChange): Added a comment
+        explaining how making this method smarter could affect WebKitTestRunner.
+
+        * UIProcess/WebPreferences.cpp:
+        (WebKit::WebPreferences::setXSSAuditorEnabled):
+        (WebKit::WebPreferences::xssAuditorEnabled):
+        * UIProcess/WebPreferences.h:
+        Implemented xssAuditorEnabled preference accessors.
+
+        * WebProcess/InjectedBundle/API/c/WKBundle.cpp: (WKBundleOverrideXSSAuditorEnabledForTestRunner):
+        * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
+        Added a private methods to temporarily change xssAuditor setting from an injected bundle,
+        not notifying UIProcess about the change.
+
+        * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::overrideXSSAuditorEnabledForTestRunner):
+        * WebProcess/InjectedBundle/InjectedBundle.h:
+        Change the setting in existing pages, and override it for future ones.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage): Take xssAuditorEnabled from preferences store.
+        (WebKit::WebPage::preferencesDidChange): If preferences change, forget our override. This only
+        happens in WKRT when the next test begins.
+
 2010-08-31  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Gavin Barraclough.
diff --git a/WebKit2/Shared/WebPreferencesStore.cpp b/WebKit2/Shared/WebPreferencesStore.cpp
index 8047094..e95026b 100644
--- a/WebKit2/Shared/WebPreferencesStore.cpp
+++ b/WebKit2/Shared/WebPreferencesStore.cpp
@@ -29,12 +29,16 @@
 
 namespace WebKit {
 
+static bool hasXSSAuditorEnabledTestRunnerOverride;
+static bool xssAuditorEnabledTestRunnerOverride;
+
 WebPreferencesStore::WebPreferencesStore()
     : javaScriptEnabled(true)
     , loadsImagesAutomatically(true)
     , pluginsEnabled(true)
     , offlineWebApplicationCacheEnabled(false)
     , localStorageEnabled(true)
+    , xssAuditorEnabled(true)
     , fontSmoothingLevel(FontSmoothingLevelMedium)
     , minimumFontSize(1)
     , minimumLogicalFontSize(9)
@@ -49,4 +53,79 @@ WebPreferencesStore::WebPreferencesStore()
 {
 }
 
+void WebPreferencesStore::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+    encoder->encode(javaScriptEnabled);
+    encoder->encode(loadsImagesAutomatically);
+    encoder->encode(pluginsEnabled);
+    encoder->encode(offlineWebApplicationCacheEnabled);
+    encoder->encode(localStorageEnabled);
+    encoder->encode(xssAuditorEnabled);
+    encoder->encode(fontSmoothingLevel);
+    encoder->encode(minimumFontSize);
+    encoder->encode(minimumLogicalFontSize);
+    encoder->encode(defaultFontSize);
+    encoder->encode(defaultFixedFontSize);
+    encoder->encode(standardFontFamily);
+    encoder->encode(cursiveFontFamily);
+    encoder->encode(fantasyFontFamily);
+    encoder->encode(fixedFontFamily);
+    encoder->encode(sansSerifFontFamily);
+    encoder->encode(serifFontFamily);
+}
+
+bool WebPreferencesStore::decode(CoreIPC::ArgumentDecoder* decoder, WebPreferencesStore& s)
+{
+    if (!decoder->decode(s.javaScriptEnabled))
+        return false;
+    if (!decoder->decode(s.loadsImagesAutomatically))
+        return false;
+    if (!decoder->decode(s.pluginsEnabled))
+        return false;
+    if (!decoder->decode(s.offlineWebApplicationCacheEnabled))
+        return false;
+    if (!decoder->decode(s.localStorageEnabled))
+        return false;
+    if (!decoder->decode(s.xssAuditorEnabled))
+        return false;
+    if (!decoder->decode(s.fontSmoothingLevel))
+        return false;
+    if (!decoder->decode(s.minimumFontSize))
+        return false;
+    if (!decoder->decode(s.minimumLogicalFontSize))
+        return false;
+    if (!decoder->decode(s.defaultFontSize))
+        return false;
+    if (!decoder->decode(s.defaultFixedFontSize))
+        return false;
+    if (!decoder->decode(s.standardFontFamily))
+        return false;
+    if (!decoder->decode(s.cursiveFontFamily))
+        return false;
+    if (!decoder->decode(s.fantasyFontFamily))
+        return false;
+    if (!decoder->decode(s.fixedFontFamily))
+        return false;
+    if (!decoder->decode(s.sansSerifFontFamily))
+        return false;
+    if (!decoder->decode(s.serifFontFamily))
+        return false;
+
+    if (hasXSSAuditorEnabledTestRunnerOverride)
+        s.xssAuditorEnabled = xssAuditorEnabledTestRunnerOverride;
+
+    return true;
+}
+
+void WebPreferencesStore::overrideXSSAuditorEnabledForTestRunner(bool enabled)
+{
+    hasXSSAuditorEnabledTestRunnerOverride = true;
+    xssAuditorEnabledTestRunnerOverride = enabled;
+}
+
+void WebPreferencesStore::removeTestRunnerOverrides()
+{
+    hasXSSAuditorEnabledTestRunnerOverride = false;
+}
+
 } // namespace WebKit
diff --git a/WebKit2/Shared/WebPreferencesStore.h b/WebKit2/Shared/WebPreferencesStore.h
index 8933461..beec838 100644
--- a/WebKit2/Shared/WebPreferencesStore.h
+++ b/WebKit2/Shared/WebPreferencesStore.h
@@ -43,6 +43,7 @@ struct WebPreferencesStore {
         encoder->encode(pluginsEnabled);
         encoder->encode(offlineWebApplicationCacheEnabled);
         encoder->encode(localStorageEnabled);
+        encoder->encode(xssAuditorEnabled);
         encoder->encode(fontSmoothingLevel);
         encoder->encode(minimumFontSize);
         encoder->encode(minimumLogicalFontSize);
@@ -56,48 +57,17 @@ struct WebPreferencesStore {
         encoder->encode(serifFontFamily);
     }
 
-    static bool decode(CoreIPC::ArgumentDecoder* decoder, WebPreferencesStore& s)
-    {
-        if (!decoder->decode(s.javaScriptEnabled))
-            return false;
-        if (!decoder->decode(s.loadsImagesAutomatically))
-            return false;
-        if (!decoder->decode(s.pluginsEnabled))
-            return false;
-        if (!decoder->decode(s.offlineWebApplicationCacheEnabled))
-            return false;
-        if (!decoder->decode(s.localStorageEnabled))
-            return false;
-        if (!decoder->decode(s.fontSmoothingLevel))
-            return false;
-        if (!decoder->decode(s.minimumFontSize))
-            return false;
-        if (!decoder->decode(s.minimumLogicalFontSize))
-            return false;
-        if (!decoder->decode(s.defaultFontSize))
-            return false;
-        if (!decoder->decode(s.defaultFixedFontSize))
-            return false;
-        if (!decoder->decode(s.standardFontFamily))
-            return false;
-        if (!decoder->decode(s.cursiveFontFamily))
-            return false;
-        if (!decoder->decode(s.fantasyFontFamily))
-            return false;
-        if (!decoder->decode(s.fixedFontFamily))
-            return false;
-        if (!decoder->decode(s.sansSerifFontFamily))
-            return false;
-        if (!decoder->decode(s.serifFontFamily))
-            return false;
-        return true;
-    }
+    static bool decode(CoreIPC::ArgumentDecoder*, WebPreferencesStore&);
+
+    static void overrideXSSAuditorEnabledForTestRunner(bool);
+    static void removeTestRunnerOverrides();
 
     bool javaScriptEnabled;
     bool loadsImagesAutomatically;
     bool pluginsEnabled;
     bool offlineWebApplicationCacheEnabled;
     bool localStorageEnabled;
+    bool xssAuditorEnabled;
 
     uint32_t fontSmoothingLevel;
 
diff --git a/WebKit2/UIProcess/API/C/WKPreferences.cpp b/WebKit2/UIProcess/API/C/WKPreferences.cpp
index 6aa19ab..3f40174 100644
--- a/WebKit2/UIProcess/API/C/WKPreferences.cpp
+++ b/WebKit2/UIProcess/API/C/WKPreferences.cpp
@@ -88,3 +88,13 @@ bool WKPreferencesGetLocalStorageEnabled(WKPreferencesRef preferencesRef)
 {
     return toWK(preferencesRef)->localStorageEnabled();
 }
+
+void WKPreferencesSetXSSAuditorEnabled(WKPreferencesRef preferencesRef, bool xssAuditorEnabled)
+{
+    toWK(preferencesRef)->setXSSAuditorEnabled(xssAuditorEnabled);
+}
+
+bool WKPreferencesGetXSSAuditorEnabled(WKPreferencesRef preferencesRef)
+{
+    return toWK(preferencesRef)->xssAuditorEnabled();
+}
diff --git a/WebKit2/UIProcess/API/C/WKPreferences.h b/WebKit2/UIProcess/API/C/WKPreferences.h
index 7c453f2..7fc6891 100644
--- a/WebKit2/UIProcess/API/C/WKPreferences.h
+++ b/WebKit2/UIProcess/API/C/WKPreferences.h
@@ -57,6 +57,10 @@ WK_EXPORT bool WKPreferencesGetOfflineWebApplicationCacheEnabled(WKPreferencesRe
 WK_EXPORT void WKPreferencesSetLocalStorageEnabled(WKPreferencesRef preferences, bool localStorageEnabled);
 WK_EXPORT bool WKPreferencesGetLocalStorageEnabled(WKPreferencesRef preferences);
 
+// Defaults to true.
+WK_EXPORT void WKPreferencesSetXSSAuditorEnabled(WKPreferencesRef preferences, bool xssAuditorEnabled);
+WK_EXPORT bool WKPreferencesGetXSSAuditorEnabled(WKPreferencesRef preferences);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 0beeab7..129aa3e 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -406,6 +406,7 @@ void WebPageProxy::preferencesDidChange()
         return;
 
     // FIXME: It probably makes more sense to send individual preference changes.
+    // However, WebKitTestRunner depends on getting a preference change notification even if nothing changed in UI process, so that overrides get removed.
     process()->send(WebPageMessage::PreferencesDidChange, m_pageID, CoreIPC::In(pageNamespace()->context()->preferences()->store()));
 }
 
diff --git a/WebKit2/UIProcess/WebPreferences.cpp b/WebKit2/UIProcess/WebPreferences.cpp
index 110a99f..752fba0 100644
--- a/WebKit2/UIProcess/WebPreferences.cpp
+++ b/WebKit2/UIProcess/WebPreferences.cpp
@@ -108,6 +108,17 @@ bool WebPreferences::localStorageEnabled() const
     return m_store.localStorageEnabled;
 }
 
+void WebPreferences::setXSSAuditorEnabled(bool b)
+{
+    m_store.xssAuditorEnabled = b;
+    update();
+}
+
+bool WebPreferences::xssAuditorEnabled() const
+{
+    return m_store.xssAuditorEnabled;
+}
+
 void WebPreferences::setFontSmoothingLevel(FontSmoothingLevel level)
 {
     m_store.fontSmoothingLevel = level;
diff --git a/WebKit2/UIProcess/WebPreferences.h b/WebKit2/UIProcess/WebPreferences.h
index ec2914c..baeed21 100644
--- a/WebKit2/UIProcess/WebPreferences.h
+++ b/WebKit2/UIProcess/WebPreferences.h
@@ -70,6 +70,9 @@ public:
     void setLocalStorageEnabled(bool);
     bool localStorageEnabled() const;
 
+    void setXSSAuditorEnabled(bool);
+    bool xssAuditorEnabled() const;
+
     void setFontSmoothingLevel(FontSmoothingLevel);
     FontSmoothingLevel fontSmoothingLevel() const;
 
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
index c5f7dd8..8a5606f 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
@@ -112,3 +112,8 @@ void WKBundleRemoveAllUserContent(WKBundleRef bundleRef)
 {
     toWK(bundleRef)->removeAllUserContent();
 }
+
+void WKBundleOverrideXSSAuditorEnabledForTestRunner(WKBundleRef bundleRef, bool enabled)
+{
+    toWK(bundleRef)->overrideXSSAuditorEnabledForTestRunner(enabled);
+}
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
index e09ab86..e4cb136 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
@@ -64,6 +64,9 @@ WK_EXPORT void WKBundleRemoveUserScripts(WKBundleRef bundle, WKBundleScriptWorld
 WK_EXPORT void WKBundleRemoveUserStyleSheets(WKBundleRef bundle, WKBundleScriptWorldRef scriptWorld);
 WK_EXPORT void WKBundleRemoveAllUserContent(WKBundleRef bundle);
 
+// Will make WebProcess ignore this preference until a preferences change notification, only for WebKitTestRunner use.
+WK_EXPORT void WKBundleOverrideXSSAuditorEnabledForTestRunner(WKBundleRef bundle, bool enabled);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
index 65e7809..07d5fb7 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
@@ -34,11 +34,14 @@
 #include "WebContextMessageKinds.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebPage.h"
+#include "WebPreferencesStore.h"
 #include "WebProcess.h"
 #include <JavaScriptCore/JSLock.h>
 #include <WebCore/GCController.h>
 #include <WebCore/JSDOMWindow.h>
+#include <WebCore/Page.h>
 #include <WebCore/PageGroup.h>
+#include <WebCore/Settings.h>
 #include <wtf/OwnArrayPtr.h>
 #include <wtf/PassOwnArrayPtr.h>
 
@@ -197,6 +200,19 @@ void InjectedBundle::removeAllVisitedLinks()
     PageGroup::removeAllVisitedLinks();
 }
 
+void InjectedBundle::overrideXSSAuditorEnabledForTestRunner(bool enabled)
+{
+    // Override the preference for all future pages.
+    WebPreferencesStore::overrideXSSAuditorEnabledForTestRunner(enabled);
+
+    // Change the setting for existing ones.
+    const HashSet<Page*>& pages = WebProcess::sharedPageGroup()->pages();
+
+    for (HashSet<Page*>::iterator iter = pages.begin(); iter != pages.end(); ++iter)
+        (*iter)->settings()->setXSSAuditorEnabled(enabled);
+}
+
+
 static PassOwnPtr<Vector<String> > toStringVector(ImmutableArray* patterns)
 {
     if (!patterns)
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h b/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
index d5b9673..6bd4e30 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
@@ -75,6 +75,7 @@ public:
     void setShouldTrackVisitedLinks(bool);
     void removeAllVisitedLinks();
     void activateMacFontAscentHack();
+    void overrideXSSAuditorEnabledForTestRunner(bool enabled);
 
     // UserContent API
     void addUserScript(InjectedBundleScriptWorld*, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserScriptInjectionTime, WebCore::UserContentInjectedFrames);
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index b66ccf3..7f6fdc6 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -103,6 +103,7 @@ WebPage::WebPage(uint64_t pageID, const IntSize& viewSize, const WebPreferencesS
     m_page->settings()->setPluginsEnabled(store.pluginsEnabled);
     m_page->settings()->setOfflineWebApplicationCacheEnabled(store.offlineWebApplicationCacheEnabled);
     m_page->settings()->setLocalStorageEnabled(store.localStorageEnabled);
+    m_page->settings()->setXSSAuditorEnabled(store.xssAuditorEnabled);
     m_page->settings()->setMinimumFontSize(store.minimumFontSize);
     m_page->settings()->setMinimumLogicalFontSize(store.minimumLogicalFontSize);
     m_page->settings()->setDefaultFontSize(store.defaultFontSize);
@@ -491,10 +492,13 @@ void WebPage::getRenderTreeExternalRepresentation(uint64_t callbackID)
 
 void WebPage::preferencesDidChange(const WebPreferencesStore& store)
 {
+    WebPreferencesStore::removeTestRunnerOverrides();
+
     m_page->settings()->setJavaScriptEnabled(store.javaScriptEnabled);
     m_page->settings()->setLoadsImagesAutomatically(store.loadsImagesAutomatically);
     m_page->settings()->setOfflineWebApplicationCacheEnabled(store.offlineWebApplicationCacheEnabled);
     m_page->settings()->setLocalStorageEnabled(store.localStorageEnabled);
+    m_page->settings()->setXSSAuditorEnabled(store.xssAuditorEnabled);
 
     platformPreferencesDidChange(store);
 }
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index ead3b45..b3d8b7c 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,20 @@
+2010-08-31  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=42195
+        <rdar://problem/8186761> WebKitTestRunner needs to support layoutTestController.setXSSAuditorEnabled
+
+        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: (WTR::LayoutTestController::setXSSAuditorEnabled):
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
+        Added setXSSAuditorEnabled, calling through to an WKBundle private method. Calling this method
+        makes WebProcess use a different value for this preference than UIProcess thinks it uses.
+
+        * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues):
+        Reset xssAuditorEnabled. Even though the value doesn't change, this calls through to WebProcess,
+        which forgets its override.
+
 2010-08-31  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Gavin Barraclough.
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
index c849a7b..f3c5e88 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
@@ -44,6 +44,7 @@ module WTR {
         void setAcceptsEditing(in boolean value);
         void setCanOpenWindows(in boolean value);
         void setCloseRemainingWindowsWhenComplete(in boolean value);
+        void setXSSAuditorEnabled(in boolean value);
         unsigned long windowCount();
 
         // Special DOM functions.
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
index d6c5a82..d54bb1d 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
@@ -239,6 +239,11 @@ void LayoutTestController::setCanOpenWindows(bool)
     // For now, just ignore this setting, and if we find later it's needed we can add it.
 }
 
+void LayoutTestController::setXSSAuditorEnabled(bool enabled)
+{
+    WKBundleOverrideXSSAuditorEnabledForTestRunner(InjectedBundle::shared().bundle(), true);
+}
+
 unsigned LayoutTestController::windowCount()
 {
     return InjectedBundle::shared().pageCount();
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
index 8368a11..2c112a7 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
@@ -62,6 +62,7 @@ public:
     void setAcceptsEditing(bool value) { m_shouldAllowEditing = value; }
     void setCanOpenWindows(bool);
     void setCloseRemainingWindowsWhenComplete(bool value) { m_shouldCloseExtraWindows = value; }
+    void setXSSAuditorEnabled(bool);
     unsigned windowCount();
 
     // Special DOM functions.
diff --git a/WebKitTools/WebKitTestRunner/TestController.cpp b/WebKitTools/WebKitTestRunner/TestController.cpp
index 32097a1..6f97b9f 100644
--- a/WebKitTools/WebKitTestRunner/TestController.cpp
+++ b/WebKitTools/WebKitTestRunner/TestController.cpp
@@ -198,6 +198,7 @@ void TestController::resetStateToConsistentValues()
     WKPreferencesRef preferences = WKContextGetPreferences(m_context.get());
     WKPreferencesSetOfflineWebApplicationCacheEnabled(preferences, true);
     WKPreferencesSetFontSmoothingLevel(preferences, kWKFontSmoothingLevelNoSubpixelAntiAliasing);
+    WKPreferencesSetXSSAuditorEnabled(preferences, false);
 
     m_mainWebView->focus();
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list