Changeset 106005 in webkit
- Timestamp:
- Jan 26, 2012 9:10:28 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r106002 r106005 1 2012-01-26 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> 2 3 Implement overridePreference for boolean preferences in WebKitTestRunner 4 https://bugs.webkit.org/show_bug.cgi?id=77033 5 6 Reviewed by Alexey Proskuryakov. 7 8 * platform/wk2/Skipped: 9 1 10 2012-01-26 Balazs Kelemen <kbalazs@webkit.org> 2 11 -
trunk/LayoutTests/platform/wk2/Skipped
r105988 r106005 193 193 fast/canvas/webgl/framebuffer-object-attachment.html 194 194 fast/canvas/webgl/gl-vertex-attrib-zero-issues.html 195 fast/events/pagehide-timeout.html196 195 fast/canvas/webgl/gl-getshadersource.html 197 196 fast/canvas/webgl/tex-sub-image-2d-bad-args.html … … 288 287 fast/canvas/webgl/webgl-array-invalid-ranges.html 289 288 fast/canvas/webgl/webgl-specific.html 290 fast/dom/Geolocation/no-page-cache.html291 fast/dom/Window/timer-resume-on-navigation-back.html292 fast/events/onunload-back-to-page-cache.html293 fast/events/pageshow-pagehide-on-back-cached-with-frames.html294 fast/events/pageshow-pagehide-on-back-cached.html295 fast/events/tab-focus-anchor.html296 fast/frames/frame-crash-with-page-cache.html297 289 fast/harness/override-preferences-2.html 298 fast/harness/override-preferences.html299 fast/harness/page-cache-crash-on-data-urls.html300 fast/harness/use-page-cache.html301 fast/history/timed-refresh-in-cached-frame.html302 290 fast/images/animated-gif-restored-from-bfcache.html 303 fast/loader/frames-with-unload-handlers-in-page-cache.html304 fast/loader/input-element-page-cache-crash.html305 fast/loader/scroll-position-restored-on-back.html306 fast/loader/stateobjects/popstate-fires-with-page-cache.html307 fast/loader/unschedule-relayout-after-unload.html308 fast/parser/noscript-with-javascript-disabled.html309 fast/parser/noscript-with-javascript-enabled.html310 291 fast/repaint/no-caret-repaint-in-non-content-editable-element.html 311 292 fast/text/zero-font-size.html 312 293 fast/text/international/locale-sensitive-fonts.html 313 http/tests/appcache/disabled.html314 css3/filters/custom-filter-shader-cache.html315 css3/filters/effect-blur.html316 css3/filters/effect-brightness.html317 css3/filters/effect-contrast.html318 css3/filters/effect-custom-combined-missing.html319 css3/filters/effect-custom-parameters.html320 css3/filters/effect-drop-shadow.html321 css3/filters/effect-grayscale.html322 css3/filters/effect-hue-rotate.html323 css3/filters/effect-invert.html324 css3/filters/effect-opacity.html325 css3/filters/effect-saturate.html326 css3/filters/effect-sepia.html327 css3/filters/missing-custom-filter-shader.html328 css3/filters/effect-custom.html329 css3/filters/effect-custom-disabled.html330 294 css3/filters/effect-combined.html 331 295 css3/filters/filter-repaint.html -
trunk/Source/WebKit2/ChangeLog
r106000 r106005 1 2012-01-26 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> 2 3 Implement overridePreference for boolean preferences in WebKitTestRunner 4 https://bugs.webkit.org/show_bug.cgi?id=77033 5 6 Reviewed by Alexey Proskuryakov. 7 8 Implement a way to WebKitTestRunner override preferences for the pages 9 loaded. Follows the same approach taken by 10 overrideXSSAuditorEnabledForTestRunner() from r66551, but generalizing to many 11 preferences. 12 13 Preferences are stored in the UI process using WebPreferencesStore, and when 14 there's a change, this data is sent to Web process, triggering 15 WebPage::preferencesDidChange(), which take a WebPreferencesStore and apply it's 16 data to the WebCore::Settings object. 17 18 The overridePreference() is executed on the Web process, and set the preferences 19 without communicating to the UI process. The overriden preferences are stored in 20 a static map and WebPreferencesStore query this map before returning the values 21 of each preference. This static map is used only on the Web process. 22 23 To clear the overrides we need to clear the map. Since WTR only sets preferences 24 when resetting the page, we hook the clearing at WebPage::preferencesDidChange(). 25 A WKPreferences private function was exposed to WTR force the update, in case 26 there's no effective change at UI process (all the properties remains the same). 27 28 This clearing could be improved by creating a proper message instead of hooking 29 at WebPage::preferencesDidChange(). 30 31 * Shared/WebPreferencesStore.cpp: 32 (WebKit::WebPreferencesStore::decode): 33 (WebKit::WebPreferencesStore::overrideBoolValueForKey): 34 (WebKit::WebPreferencesStore::removeTestRunnerOverrides): 35 (WebKit::WebPreferencesStore::getBoolValueForKey): 36 * Shared/WebPreferencesStore.h: 37 * UIProcess/API/C/WKPreferences.cpp: 38 (WKPreferencesResetTestRunnerOverrides): 39 * UIProcess/API/C/WKPreferencesPrivate.h: 40 * UIProcess/WebPreferences.h: 41 (WebKit::WebPreferences::forceUpdate): 42 * WebProcess/InjectedBundle/API/c/WKBundle.cpp: 43 (WKBundleOverrideBoolPreferenceForTestRunner): 44 * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: 45 * WebProcess/InjectedBundle/InjectedBundle.cpp: 46 (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): 47 (WebKit::InjectedBundle::overrideXSSAuditorEnabledForTestRunner): 48 * WebProcess/InjectedBundle/InjectedBundle.h: 49 1 50 2012-01-26 Carlos Garcia Campos <cgarcia@igalia.com> 2 51 -
trunk/Source/WebKit2/Shared/WebPreferencesStore.cpp
r95901 r106005 49 49 50 50 51 static bool hasXSSAuditorEnabledTestRunnerOverride; 52 static bool xssAuditorEnabledTestRunnerOverride; 51 static HashMap<String, bool> boolTestRunnerOverridesMap; 53 52 54 53 WebPreferencesStore::WebPreferencesStore() … … 74 73 if (!decoder->decode(result.m_doubleValues)) 75 74 return false; 76 77 if (hasXSSAuditorEnabledTestRunnerOverride)78 result.m_boolValues.set(WebPreferencesKey::xssAuditorEnabledKey(), xssAuditorEnabledTestRunnerOverride);79 80 75 return true; 81 76 } 82 77 83 void WebPreferencesStore::overrideXSSAuditorEnabledForTestRunner(bool enabled) 84 { 85 hasXSSAuditorEnabledTestRunnerOverride = true; 86 xssAuditorEnabledTestRunnerOverride = enabled; 78 void WebPreferencesStore::overrideBoolValueForKey(const String& key, bool value) 79 { 80 boolTestRunnerOverridesMap.set(key, value); 87 81 } 88 82 89 83 void WebPreferencesStore::removeTestRunnerOverrides() 90 84 { 91 hasXSSAuditorEnabledTestRunnerOverride = false;85 boolTestRunnerOverridesMap.clear(); 92 86 } 93 87 … … 186 180 bool WebPreferencesStore::getBoolValueForKey(const String& key) const 187 181 { 182 // FIXME: Extend overriding to other key types used from LayoutTestController. 183 HashMap<String, bool>::const_iterator it = boolTestRunnerOverridesMap.find(key); 184 if (it != boolTestRunnerOverridesMap.end()) 185 return it->second; 188 186 return valueForKey(m_boolValues, key); 189 187 } -
trunk/Source/WebKit2/Shared/WebPreferencesStore.h
r105571 r106005 215 215 double getDoubleValueForKey(const String& key) const; 216 216 217 static void overrideXSSAuditorEnabledForTestRunner(bool); 217 // For WebKitTestRunner usage. 218 static void overrideBoolValueForKey(const String& key, bool value); 218 219 static void removeTestRunnerOverrides(); 219 220 -
trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
r105485 r106005 732 732 return toImpl(preferencesRef)->notificationsEnabled(); 733 733 } 734 735 void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef) 736 { 737 // Currently we reset the overrides on the web process when preferencesDidChange() is called. Since WTR preferences 738 // are usually always the same (in the UI process), they are not sent to web process, not triggering the reset. 739 toImpl(preferencesRef)->forceUpdate(); 740 } -
trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
r105485 r106005 161 161 WK_EXPORT bool WKPreferencesGetApplicationChromeModeEnabled(WKPreferencesRef preferencesRef); 162 162 163 WK_EXPORT void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef); 164 163 165 #ifdef __cplusplus 164 166 } -
trunk/Source/WebKit2/UIProcess/WebPreferences.h
r95901 r106005 70 70 #undef DECLARE_PREFERENCE_GETTER_AND_SETTERS 71 71 72 // Exposed for WebKitTestRunner use only. 73 void forceUpdate() { update(); } 74 72 75 private: 73 76 WebPreferences(); -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
r105988 r106005 127 127 } 128 128 129 void WKBundleOverride XSSAuditorEnabledForTestRunner(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled)130 { 131 toImpl(bundleRef)->override XSSAuditorEnabledForTestRunner(toImpl(pageGroupRef), enabled);129 void WKBundleOverrideBoolPreferenceForTestRunner(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKStringRef preference, bool enabled) 130 { 131 toImpl(bundleRef)->overrideBoolPreferenceForTestRunner(toImpl(pageGroupRef), toImpl(preference)->string(), enabled); 132 132 } 133 133 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
r105988 r106005 65 65 66 66 // Will make WebProcess ignore this preference until a preferences change notification, only for WebKitTestRunner use. 67 WK_EXPORT void WKBundleOverrideXSSAuditorEnabledForTestRunner(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 67 WK_EXPORT void WKBundleOverrideBoolPreferenceForTestRunner(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKStringRef preference, bool enabled); 68 68 69 WK_EXPORT void WKBundleSetAllowUniversalAccessFromFileURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); 69 70 WK_EXPORT void WKBundleSetAllowFileAccessFromFileURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled); -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
r105988 r106005 32 32 #include "InjectedBundleScriptWorld.h" 33 33 #include "InjectedBundleUserMessageCoders.h" 34 #include "LayerTreeHost.h" 34 35 #include "WKAPICast.h" 35 36 #include "WKBundleAPICast.h" … … 118 119 } 119 120 121 void InjectedBundle::overrideBoolPreferenceForTestRunner(WebPageGroupProxy* pageGroup, const String& preference, bool enabled) 122 { 123 const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages(); 124 125 // FIXME: Need an explicit way to set "WebKitTabToLinksPreferenceKey" directly in WebPage. 126 127 // Map the names used in LayoutTests with the names used in WebCore::Settings and WebPreferencesStore. 128 #define FOR_EACH_OVERRIDE_BOOL_PREFERENCE(macro) \ 129 macro(WebKitAcceleratedCompositingEnabled, AcceleratedCompositingEnabled, acceleratedCompositingEnabled) \ 130 macro(WebKitCSSCustomFilterEnabled, CSSCustomFilterEnabled, cssCustomFilterEnabled) \ 131 macro(WebKitJavaEnabled, JavaEnabled, javaEnabled) \ 132 macro(WebKitJavaScriptEnabled, ScriptEnabled, javaScriptEnabled) \ 133 macro(WebKitLoadSiteIconsKey, LoadsSiteIconsIgnoringImageLoadingSetting, loadsSiteIconsIgnoringImageLoadingPreference) \ 134 macro(WebKitOfflineWebApplicationCacheEnabled, OfflineWebApplicationCacheEnabled, offlineWebApplicationCacheEnabled) \ 135 macro(WebKitPageCacheSupportsPluginsPreferenceKey, PageCacheSupportsPlugins, pageCacheSupportsPlugins) \ 136 macro(WebKitPluginsEnabled, PluginsEnabled, pluginsEnabled) \ 137 macro(WebKitUsesPageCachePreferenceKey, UsesPageCache, usesPageCache) \ 138 macro(WebKitWebAudioEnabled, WebAudioEnabled, webAudioEnabled) \ 139 macro(WebKitWebGLEnabled, WebGLEnabled, webGLEnabled) \ 140 macro(WebKitXSSAuditorEnabled, XSSAuditorEnabled, xssAuditorEnabled) 141 142 if (preference == "WebKitAcceleratedCompositingEnabled") 143 enabled = enabled && LayerTreeHost::supportsAcceleratedCompositing(); 144 145 #define OVERRIDE_PREFERENCE_AND_SET_IN_EXISTING_PAGES(TestRunnerName, SettingsName, WebPreferencesName) \ 146 if (preference == #TestRunnerName) { \ 147 WebPreferencesStore::overrideBoolValueForKey(WebPreferencesKey::WebPreferencesName##Key(), enabled); \ 148 for (HashSet<Page*>::iterator iter = pages.begin(); iter != pages.end(); ++iter) \ 149 (*iter)->settings()->set##SettingsName(enabled); \ 150 return; \ 151 } 152 153 FOR_EACH_OVERRIDE_BOOL_PREFERENCE(OVERRIDE_PREFERENCE_AND_SET_IN_EXISTING_PAGES) 154 155 #if ENABLE(WEB_SOCKETS) 156 OVERRIDE_PREFERENCE_AND_SET_IN_EXISTING_PAGES("WebKitHixie76WebSocketProtocolEnabled", UseHixie76WebSocketProtocol, hixie76WebSocketProtocolEnabled) 157 #endif 158 159 #undef OVERRIDE_PREFERENCE_AND_SET_IN_EXISTING_PAGES 160 #undef FOR_EACH_OVERRIDE_BOOL_PREFERENCE 161 } 162 120 163 void InjectedBundle::overrideXSSAuditorEnabledForTestRunner(WebPageGroupProxy* pageGroup, bool enabled) 121 164 { 122 165 // Override the preference for all future pages. 123 WebPreferencesStore::override XSSAuditorEnabledForTestRunner(enabled);166 WebPreferencesStore::overrideBoolValueForKey(WebPreferencesKey::xssAuditorEnabledKey(), enabled); 124 167 125 168 // Change the setting for existing ones. -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
r105988 r106005 98 98 void removeAllVisitedLinks(); 99 99 void activateMacFontAscentHack(); 100 void overrideBoolPreferenceForTestRunner(WebPageGroupProxy*, const String& preference, bool enabled); 100 101 void overrideXSSAuditorEnabledForTestRunner(WebPageGroupProxy* pageGroup, bool enabled); 101 102 void setAllowUniversalAccessFromFileURLs(WebPageGroupProxy*, bool); -
trunk/Tools/ChangeLog
r106004 r106005 1 2012-01-26 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> 2 3 Implement overridePreference for boolean preferences in WebKitTestRunner 4 https://bugs.webkit.org/show_bug.cgi?id=77033 5 6 Reviewed by Alexey Proskuryakov. 7 8 For now overridePreference supports boolean values. 9 10 * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: 11 * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: 12 (WTR::LayoutTestController::setXSSAuditorEnabled): 13 (WTR::LayoutTestController::overridePreference): 14 * WebKitTestRunner/InjectedBundle/LayoutTestController.h: 15 * WebKitTestRunner/TestController.cpp: 16 (WTR::TestController::resetStateToConsistentValues): Reset the overrides 17 explicitly and properly disable the use of PageCache when resetting the 18 state. Tests that use PageCache can now enable it via overridePreference. 19 1 20 2012-01-26 Alexander Færøy <alexander.faeroy@nokia.com> 2 21 -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
r105988 r106005 134 134 135 135 void setWindowIsKey(in boolean isKey); 136 136 137 // FIXME: handle non-boolean preferences. 138 void overridePreference(in DOMString preference, in boolean value); 139 137 140 readonly attribute DOMString platformName; 138 141 }; -
trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
r105988 r106005 351 351 void LayoutTestController::setXSSAuditorEnabled(bool enabled) 352 352 { 353 WKBundleOverrideXSSAuditorEnabledForTestRunner(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), true); 353 WKRetainPtr<WKStringRef> key(AdoptWK, WKStringCreateWithUTF8CString("WebKitXSSAuditorEnabled")); 354 WKBundleOverrideBoolPreferenceForTestRunner(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), key.get(), enabled); 354 355 } 355 356 … … 614 615 } 615 616 617 void LayoutTestController::overridePreference(JSStringRef preference, bool value) 618 { 619 WKBundleOverrideBoolPreferenceForTestRunner(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), toWK(preference).get(), value); 620 } 621 616 622 } // namespace WTR -
trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
r105988 r106005 193 193 void callSetBackingScaleFactorCallback(); 194 194 195 void overridePreference(JSStringRef preference, bool value); 196 195 197 JSRetainPtr<JSStringRef> platformName(); 196 198 -
trunk/Tools/WebKitTestRunner/TestController.cpp
r104910 r106005 416 416 // Reset preferences 417 417 WKPreferencesRef preferences = WKPageGroupGetPreferences(m_pageGroup.get()); 418 WKPreferencesResetTestRunnerOverrides(preferences); 418 419 WKPreferencesSetOfflineWebApplicationCacheEnabled(preferences, true); 419 420 WKPreferencesSetFontSmoothingLevel(preferences, kWKFontSmoothingLevelNoSubpixelAntiAliasing); … … 428 429 WKPreferencesSetFullScreenEnabled(preferences, true); 429 430 #endif 431 WKPreferencesSetPageCacheEnabled(preferences, false); 430 432 431 433 // [Qt][WK2]REGRESSION(r104881):It broke hundreds of tests
Note: See TracChangeset
for help on using the changeset viewer.