Reviewed by Sam Weinig.
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Aug 2010 23:13:58 +0000 (23:13 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Aug 2010 23:13:58 +0000 (23:13 +0000)
commit50fe723f8b2d57ef2da7a10e211fe2671a55e6aa
tree5d45d701658e4a919a0bf5ea8a7c58a4977802e6
parent82d61e8356a0e1a8e6ded0774cde1d2d6bf9eb22
    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: https://svn.webkit.org/repository/webkit/trunk@66551 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/Skipped
WebKit2/ChangeLog
WebKit2/Shared/WebPreferencesStore.cpp
WebKit2/Shared/WebPreferencesStore.h
WebKit2/UIProcess/API/C/WKPreferences.cpp
WebKit2/UIProcess/API/C/WKPreferences.h
WebKit2/UIProcess/WebPageProxy.cpp
WebKit2/UIProcess/WebPreferences.cpp
WebKit2/UIProcess/WebPreferences.h
WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
WebKit2/WebProcess/WebPage/WebPage.cpp
WebKitTools/ChangeLog
WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
WebKitTools/WebKitTestRunner/TestController.cpp