Title: [269226] trunk
Revision
269226
Author
wei...@apple.com
Date
2020-10-31 09:08:51 -0700 (Sat, 31 Oct 2020)

Log Message

Remove all remaining testRunner.overridePreference calls
https://bugs.webkit.org/show_bug.cgi?id=218373

Reviewed by Simon Fraser.

Tools:

Remove implementations of testRunner.overridePreference. Adds testRunner.setShouldInvertColors,
which is a windows only preference. When we generate preferences for Windows, we can convert
this to use test header commands instead.

Also add default for MinimumFontSize so it can be used as test header commands for DumpRenderTree.

* DumpRenderTree/TestOptions.cpp:
(WTR::TestOptions::defaults):
* DumpRenderTree/TestRunner.cpp:
(setShouldInvertColors):
(TestRunner::staticFunctions):
(overridePreferenceCallback): Deleted.
* DumpRenderTree/TestRunner.h:
* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::overridePreference): Deleted.
* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::setShouldInvertColors):
(TestRunner::overridePreference): Deleted.
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::toBool): Deleted.
(WTR::TestRunner::overridePreference): Deleted.

LayoutTests:

Removes remaining uses of testRunner.overridePreference and addresses some
recent feedback by removing some unnecessary "window." uses.

Also removed test cross-origin-local-storage-wk1.html as it is redundant with
other tests such as cross-origin-local-storage.html which uses internals instead.

* fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html:
* fast/parser/noscript-with-_javascript_-disabled.html:
* fast/text/international/locale-sensitive-fonts.html:
* fast/text/zero-font-size.html:
* http/tests/download/default-encoding.html:
* http/tests/misc/favicon-loads-with-images-disabled.html:
* http/tests/security/cross-origin-local-storage-wk1-expected.txt: Removed.
* http/tests/security/cross-origin-local-storage-wk1.html: Removed.
* http/tests/security/resources/load-local-storage.html:
* http/tests/xsl/xslt-transform-with-_javascript_-disabled.html:
* platform/ios-wk1/TestExpectations:
* platform/mac-wk2/http/tests/security/cross-origin-local-storage-wk1-expected.txt: Removed.
* platform/mac/http/tests/security/cross-origin-local-storage-wk1-expected.txt: Removed.
* platform/win/TestExpectations:
* platform/win/inverted-colors/non-composited.html:
* platform/wk2/TestExpectations:
* svg/as-image/svg-image-with-data-uri-images-disabled.html:

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (269225 => 269226)


--- trunk/LayoutTests/ChangeLog	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/ChangeLog	2020-10-31 16:08:51 UTC (rev 269226)
@@ -1,3 +1,50 @@
+2020-10-31  Sam Weinig  <wei...@apple.com>
+
+        Remove all remaining testRunner.overridePreference calls
+        https://bugs.webkit.org/show_bug.cgi?id=218373
+
+        Reviewed by Simon Fraser.
+
+        Removes remaining uses of testRunner.overridePreference and addresses some
+        recent feedback by removing some unnecessary "window." uses.
+
+        Also removed test cross-origin-local-storage-wk1.html as it is redundant with
+        other tests such as cross-origin-local-storage.html which uses internals instead.
+
+        * fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html:
+        * fast/parser/noscript-with-_javascript_-disabled.html:
+        * fast/text/international/locale-sensitive-fonts.html:
+        * fast/text/zero-font-size.html:
+        * http/tests/download/default-encoding.html:
+        * http/tests/misc/favicon-loads-with-images-disabled.html:
+        * http/tests/security/cross-origin-local-storage-wk1-expected.txt: Removed.
+        * http/tests/security/cross-origin-local-storage-wk1.html: Removed.
+        * http/tests/security/resources/load-local-storage.html:
+        * http/tests/xsl/xslt-transform-with-_javascript_-disabled.html:
+        * platform/ios-wk1/TestExpectations:
+        * platform/mac-wk2/http/tests/security/cross-origin-local-storage-wk1-expected.txt: Removed.
+        * platform/mac/http/tests/security/cross-origin-local-storage-wk1-expected.txt: Removed.
+        * platform/win/TestExpectations:
+        * platform/win/inverted-colors/non-composited.html:
+        * platform/wk2/TestExpectations:
+        * svg/as-image/svg-image-with-data-uri-images-disabled.html:
+
+2020-10-29  Sam Weinig  <wei...@apple.com>
+
+
+        * fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html:
+        * fast/parser/noscript-with-_javascript_-disabled.html:
+        * fast/text/international/locale-sensitive-fonts.html:
+        * fast/text/zero-font-size.html:
+        * http/tests/download/default-encoding.html:
+        * http/tests/misc/favicon-loads-with-images-disabled.html:
+        * http/tests/security/cross-origin-local-storage-wk1.html:
+        * http/tests/security/resources/load-local-storage.html:
+        * http/tests/xsl/xslt-transform-with-_javascript_-disabled.html:
+        * platform/win/inverted-colors/non-composited.html:
+        * platform/wk2/TestExpectations:
+        * svg/as-image/svg-image-with-data-uri-images-disabled.html:
+
 2020-10-31  Zalan Bujtas  <za...@apple.com>
 
         Remove unneeded whitespace between content and <br>

Modified: trunk/LayoutTests/fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html (269225 => 269226)


--- trunk/LayoutTests/fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html	2020-10-31 16:08:51 UTC (rev 269226)
@@ -8,8 +8,8 @@
 
 if (window.testRunner) {
     testRunner.dumpAsText();
-    window.internals.settings.setImagesEnabled(true);
-    window.internals.settings.setLoadsImagesAutomatically(false);
+    internals.settings.setImagesEnabled(true);
+    internals.settings.setLoadsImagesAutomatically(false);
     testRunner.queueReload();
 }
 
@@ -21,7 +21,7 @@
         return;
     }
 
-    window.internals.settings.setLoadsImagesAutomatically(true);
+    internals.settings.setLoadsImagesAutomatically(true);
     document.getElementById('result').innerHTML = 'FAILURE: Image should reload in-place when loadsImagesAutomatically is changes from unset to set';
     testRunner.waitUntilDone();
     intervalId = window.setInterval(runTestRest, 10);

Modified: trunk/LayoutTests/fast/parser/noscript-with-_javascript_-disabled.html (269225 => 269226)


--- trunk/LayoutTests/fast/parser/noscript-with-_javascript_-disabled.html	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/fast/parser/noscript-with-_javascript_-disabled.html	2020-10-31 16:08:51 UTC (rev 269226)
@@ -4,7 +4,7 @@
 if (window.testRunner) {
     testRunner.dumpAsText();
     testRunner.dumpChildFramesAsText();
-    window.internals.settings.setScriptEnabled(false);
+    internals.settings.setScriptEnabled(false);
 }
 </script>
 

Modified: trunk/LayoutTests/fast/text/international/locale-sensitive-fonts.html (269225 => 269226)


--- trunk/LayoutTests/fast/text/international/locale-sensitive-fonts.html	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/fast/text/international/locale-sensitive-fonts.html	2020-10-31 16:08:51 UTC (rev 269226)
@@ -3,16 +3,16 @@
 <head>
 <script>
 if (window.internals) {
-    window.internals.settings.setStandardFontFamily("Ahem", "Hans");
-    window.internals.settings.setFantasyFontFamily("Ahem", "Hans");
+    internals.settings.setStandardFontFamily("Ahem", "Hans");
+    internals.settings.setFantasyFontFamily("Ahem", "Hans");
 
-    window.internals.setUserPreferredLanguages("en", "zh-cn");
+    internals.setUserPreferredLanguages("en", "zh-cn");
 }
 </script>
 </head>
 <body>
-<!-- This tests locale-sensitive font selection.  Using overridePreference,  the
-fonts for Simplified Han are to Ahem font.  So all divs should match. -->
+<!-- This tests locale-sensitive font selection. Using internals.settings, the
+fonts for Simplified Han are set to the Ahem font. All divs should match. -->
 <div style="font-size: 20px">
 <div style="font-family: 'Ahem'">this is ahem font</div>
 <div style="-webkit-locale: 'zh_CN'">this is ahem font</div>

Modified: trunk/LayoutTests/fast/text/zero-font-size.html (269225 => 269226)


--- trunk/LayoutTests/fast/text/zero-font-size.html	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/fast/text/zero-font-size.html	2020-10-31 16:08:51 UTC (rev 269226)
@@ -1,7 +1,4 @@
-<script>
-    if (window.testRunner)
-        testRunner.overridePreference("WebKitMinimumFontSize", "12");
-</script>
+<!-- webkit-test-runner [ MinimumFontSize=12 ] -->
 <p>Test that text with 0px font size is not displayed, even if a non-zero minimum font size setting is specified. On success, this paragraph should be the only text visible on the page.</p>
 <div style="font-size:0px; color:red">FAIL</div>
 <div style="font-size:0%; color:red">FAIL</div>
\ No newline at end of file

Modified: trunk/LayoutTests/http/tests/download/default-encoding.html (269225 => 269226)


--- trunk/LayoutTests/http/tests/download/default-encoding.html	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/http/tests/download/default-encoding.html	2020-10-31 16:08:51 UTC (rev 269226)
@@ -2,7 +2,7 @@
 <script>
 if (window.testRunner) {
     testRunner.dumpAsText();
-    testRunner.overridePreference("WebKitDefaultTextEncodingName", "koi8-r");
+    internals.settings.setDefaultTextEncodingName("koi8-r");
     testRunner.setCustomPolicyDelegate(true, true);
     testRunner.waitForPolicyDelegate();
 }

Modified: trunk/LayoutTests/http/tests/misc/favicon-loads-with-images-disabled.html (269225 => 269226)


--- trunk/LayoutTests/http/tests/misc/favicon-loads-with-images-disabled.html	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/http/tests/misc/favicon-loads-with-images-disabled.html	2020-10-31 16:08:51 UTC (rev 269226)
@@ -7,7 +7,6 @@
         testRunner.dumpAsText();
         testRunner.dumpResourceLoadCallbacks();
         testRunner.setIconDatabaseEnabled(true);
-        testRunner.overridePreference("WebKitDisplayImagesKey", 0);
         testRunner.queueReload();
     }
 }

Deleted: trunk/LayoutTests/http/tests/security/cross-origin-local-storage-wk1-expected.txt (269225 => 269226)


--- trunk/LayoutTests/http/tests/security/cross-origin-local-storage-wk1-expected.txt	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/http/tests/security/cross-origin-local-storage-wk1-expected.txt	2020-10-31 16:08:51 UTC (rev 269226)
@@ -1 +0,0 @@
-Got value: value

Deleted: trunk/LayoutTests/http/tests/security/cross-origin-local-storage-wk1.html (269225 => 269226)


--- trunk/LayoutTests/http/tests/security/cross-origin-local-storage-wk1.html	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/http/tests/security/cross-origin-local-storage-wk1.html	2020-10-31 16:08:51 UTC (rev 269226)
@@ -1,18 +0,0 @@
-<html>
-<head>
-<script>
-if (window.testRunner) {
-	testRunner.dumpAsText();
-	testRunner.waitUntilDone();
-	testRunner.overridePreference('WebKitStorageBlockingPolicy', 1);
-}
-
-function continueTest() {
-	window.location.href = '';
-}
-</script>
-</head>
-<body>
-<iframe src="" _onload_="continueTest()"></iframe>
-</body>
-</html>

Modified: trunk/LayoutTests/http/tests/security/resources/load-local-storage.html (269225 => 269226)


--- trunk/LayoutTests/http/tests/security/resources/load-local-storage.html	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/http/tests/security/resources/load-local-storage.html	2020-10-31 16:08:51 UTC (rev 269226)
@@ -16,7 +16,6 @@
 
 if (window.testRunner) {
 	internals.settings.setStorageBlockingPolicy('AllowAll');
-	testRunner.overridePreference('WebKitStorageBlockingPolicy', 0);
 	testRunner.notifyDone();
 }
 </script>

Modified: trunk/LayoutTests/http/tests/xsl/xslt-transform-with-_javascript_-disabled.html (269225 => 269226)


--- trunk/LayoutTests/http/tests/xsl/xslt-transform-with-_javascript_-disabled.html	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/http/tests/xsl/xslt-transform-with-_javascript_-disabled.html	2020-10-31 16:08:51 UTC (rev 269226)
@@ -4,7 +4,7 @@
 if (window.testRunner) {
     testRunner.dumpAsText();
     testRunner.dumpChildFramesAsText();
-    window.internals.settings.setScriptEnabled(false);
+    internals.settings.setScriptEnabled(false);
 }
 
 function shouldNotBeExecuted()

Modified: trunk/LayoutTests/platform/ios-wk1/TestExpectations (269225 => 269226)


--- trunk/LayoutTests/platform/ios-wk1/TestExpectations	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/platform/ios-wk1/TestExpectations	2020-10-31 16:08:51 UTC (rev 269226)
@@ -1094,7 +1094,6 @@
 http/tests/security/aboutBlank/xss-DENIED-navigate-opener-_javascript_-url.html [ Failure ]
 http/tests/security/aboutBlank/xss-DENIED-set-opener.html [ Failure ]
 http/tests/security/contentSecurityPolicy/object-src-url-allowed.html [ Failure ]
-http/tests/security/cross-origin-local-storage-wk1.html [ Failure ]
 http/tests/security/frameNavigation/not-opener.html [ Failure ]
 http/tests/security/mixedContent/insecure-audio-video-in-main-frame.html [ Failure ]
 http/tests/security/mixedContent/insecure-css-in-main-frame.html [ Failure ]

Deleted: trunk/LayoutTests/platform/mac/http/tests/security/cross-origin-local-storage-wk1-expected.txt (269225 => 269226)


--- trunk/LayoutTests/platform/mac/http/tests/security/cross-origin-local-storage-wk1-expected.txt	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/platform/mac/http/tests/security/cross-origin-local-storage-wk1-expected.txt	2020-10-31 16:08:51 UTC (rev 269226)
@@ -1 +0,0 @@
-No value

Deleted: trunk/LayoutTests/platform/mac-wk2/http/tests/security/cross-origin-local-storage-wk1-expected.txt (269225 => 269226)


--- trunk/LayoutTests/platform/mac-wk2/http/tests/security/cross-origin-local-storage-wk1-expected.txt	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/platform/mac-wk2/http/tests/security/cross-origin-local-storage-wk1-expected.txt	2020-10-31 16:08:51 UTC (rev 269226)
@@ -1 +0,0 @@
-Got value: value

Modified: trunk/LayoutTests/platform/win/TestExpectations (269225 => 269226)


--- trunk/LayoutTests/platform/win/TestExpectations	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/platform/win/TestExpectations	2020-10-31 16:08:51 UTC (rev 269226)
@@ -2390,7 +2390,6 @@
 http/tests/security/cross-frame-access-getOwnPropertyDescriptor.html [ Failure ]
 http/tests/security/cross-origin-appcache-allowed.html [ Failure ]
 http/tests/security/cross-origin-appcache.html [ Failure ]
-webkit.org/b/98079 http/tests/security/cross-origin-local-storage-wk1.html [ Failure ]
 http/tests/security/cross-origin-plugin-allowed.html [ Failure ]
 http/tests/security/cross-origin-plugin-private-browsing-toggled-allowed.html [ Failure ]
 http/tests/security/cross-origin-plugin-private-browsing-toggled.html [ Failure ]

Modified: trunk/LayoutTests/platform/win/inverted-colors/non-composited.html (269225 => 269226)


--- trunk/LayoutTests/platform/win/inverted-colors/non-composited.html	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/platform/win/inverted-colors/non-composited.html	2020-10-31 16:08:51 UTC (rev 269226)
@@ -16,7 +16,7 @@
     </style>
     <script>
         if (window.testRunner)
-            testRunner.overridePreference("WebKitShouldInvertColors", "1");
+            testRunner.setShouldInvertColors(true);
     </script>
 </head>
 <body>

Modified: trunk/LayoutTests/platform/wk2/TestExpectations (269225 => 269226)


--- trunk/LayoutTests/platform/wk2/TestExpectations	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/platform/wk2/TestExpectations	2020-10-31 16:08:51 UTC (rev 269226)
@@ -57,10 +57,6 @@
 # This test has been skipped for a long time. Temporarily marking as flaky to see what bots think.
 webkit.org/b/60648 fast/frames/flattening/frameset-flattening-subframesets.html [ Pass Failure ]
 
-# WebKitTestRunner needs overridePreference for non-boolean values
-# (zero-font-size.html passes because overridePreference does not work)
-webkit.org/b/42197 fast/text/zero-font-size.html [ Pass ]
-
 webkit.org/b/82665 http/tests/webarchive/test-css-url-encoding.html [ Skip ]
 webkit.org/b/82665 http/tests/webarchive/test-css-url-encoding-shift-jis.html [ Skip ]
 webkit.org/b/82665 http/tests/webarchive/test-css-url-encoding-utf-8.html [ Skip ]

Modified: trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-images-disabled.html (269225 => 269226)


--- trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-images-disabled.html	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/LayoutTests/svg/as-image/svg-image-with-data-uri-images-disabled.html	2020-10-31 16:08:51 UTC (rev 269226)
@@ -10,8 +10,8 @@
   </style>
   <script>
     if (window.testRunner) {
-      window.internals.settings.setImagesEnabled(false);
-      window.internals.settings.setLoadsImagesAutomatically(false);
+      internals.settings.setImagesEnabled(false);
+      internals.settings.setLoadsImagesAutomatically(false);
       testRunner.queueReload();
     }
   </script>

Modified: trunk/Tools/ChangeLog (269225 => 269226)


--- trunk/Tools/ChangeLog	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/Tools/ChangeLog	2020-10-31 16:08:51 UTC (rev 269226)
@@ -1,3 +1,33 @@
+2020-10-31  Sam Weinig  <wei...@apple.com>
+
+        Remove all remaining testRunner.overridePreference calls
+        https://bugs.webkit.org/show_bug.cgi?id=218373
+
+        Reviewed by Simon Fraser.
+
+        Remove implementations of testRunner.overridePreference. Adds testRunner.setShouldInvertColors,
+        which is a windows only preference. When we generate preferences for Windows, we can convert
+        this to use test header commands instead.
+        
+        Also add default for MinimumFontSize so it can be used as test header commands for DumpRenderTree.
+
+        * DumpRenderTree/TestOptions.cpp:
+        (WTR::TestOptions::defaults):
+        * DumpRenderTree/TestRunner.cpp:
+        (setShouldInvertColors):
+        (TestRunner::staticFunctions):
+        (overridePreferenceCallback): Deleted.
+        * DumpRenderTree/TestRunner.h:
+        * DumpRenderTree/mac/TestRunnerMac.mm:
+        (TestRunner::overridePreference): Deleted.
+        * DumpRenderTree/win/TestRunnerWin.cpp:
+        (TestRunner::setShouldInvertColors):
+        (TestRunner::overridePreference): Deleted.
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::toBool): Deleted.
+        (WTR::TestRunner::overridePreference): Deleted.
+
 2020-10-30  Jonathan Bedard  <jbed...@apple.com>
 
         [webkitpy] Use allowlist and blocklist

Modified: trunk/Tools/DumpRenderTree/TestOptions.cpp (269225 => 269226)


--- trunk/Tools/DumpRenderTree/TestOptions.cpp	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/Tools/DumpRenderTree/TestOptions.cpp	2020-10-31 16:08:51 UTC (rev 269226)
@@ -84,6 +84,9 @@
             { "ResizeObserverEnabled", false },
             { "WebGPUEnabled", false },
         };
+        features.uint32WebPreferenceFeatures = {
+            { "MinimumFontSize", 0 },
+        };
     }
     return features;
 }

Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (269225 => 269226)


--- trunk/Tools/DumpRenderTree/TestRunner.cpp	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp	2020-10-31 16:08:51 UTC (rev 269226)
@@ -555,23 +555,6 @@
     return JSValueMakeBoolean(context, controller->isCommandEnabled(name.get()));
 }
 
-static JSValueRef overridePreferenceCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
-{
-    if (argumentCount < 2)
-        return JSValueMakeUndefined(context);
-
-    auto key = WTR::createJSString(context, arguments[0]);
-    auto value = WTR::createJSString(context, arguments[1]);
-
-    // Should use `<!-- webkit-test-runner [ enableBackForwardCache=true ] -->` instead.
-    RELEASE_ASSERT(!JSStringIsEqualToUTF8CString(key.get(), "WebKitUsesBackForwardCachePreferenceKey"));
-
-    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
-    controller->overridePreference(key.get(), value.get());
-
-    return JSValueMakeUndefined(context);
-}
-
 static JSValueRef keepWebHistoryCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     // Has mac implementation
@@ -2005,6 +1988,21 @@
     return JSValueMakeUndefined(context);
 }
 
+#if PLATFORM(WIN)
+
+static JSValueRef setShouldInvertColorsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    if (argumentCount < 1)
+        return JSValueMakeUndefined(context);
+
+    auto controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
+    controller->setShouldInvertColors(JSValueToBoolean(context, arguments[0]));
+
+    return JSValueMakeUndefined(context);
+}
+
+#endif
+
 static void testRunnerObjectFinalize(JSObjectRef object)
 {
     static_cast<TestRunner*>(JSObjectGetPrivate(object))->deref();
@@ -2138,7 +2136,6 @@
         { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "numberOfPendingGeolocationPermissionRequests", numberOfPendingGeolocationPermissionRequestsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "notifyDone", notifyDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
-        { "overridePreference", overridePreferenceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "pathToLocalResource", pathToLocalResourceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "printToPDF", dumpAsPDFCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "queueBackNavigation", queueBackNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
@@ -2245,6 +2242,9 @@
         { "setOpenPanelFiles", setOpenPanelFilesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setOpenPanelFilesMediaIcon", SetOpenPanelFilesMediaIconCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "forceImmediateCompletion", forceImmediateCompletionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+#if PLATFORM(WIN)
+        { "setShouldInvertColors", setShouldInvertColorsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+#endif
         { 0, 0, 0 }
     };
 

Modified: trunk/Tools/DumpRenderTree/TestRunner.h (269225 => 269226)


--- trunk/Tools/DumpRenderTree/TestRunner.h	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/Tools/DumpRenderTree/TestRunner.h	2020-10-31 16:08:51 UTC (rev 269226)
@@ -131,6 +131,9 @@
     void setTelephoneNumberParsingEnabled(bool enable);
     void setPagePaused(bool paused);
 #endif
+#if PLATFORM(WIN)
+    void setShouldInvertColors(bool);
+#endif
 
     void setPageVisibility(const char*);
     void resetPageVisibility();

Modified: trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm (269225 => 269226)


--- trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm	2020-10-31 16:08:51 UTC (rev 269226)
@@ -596,17 +596,6 @@
     [[mainFrame webView] _dispatchPendingLoadRequests];
 }
 
-void TestRunner::overridePreference(JSStringRef key, JSStringRef value)
-{
-    RetainPtr<CFStringRef> keyCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, key));
-    NSString *keyNS = (__bridge NSString *)keyCF.get();
-
-    RetainPtr<CFStringRef> valueCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, value));
-    NSString *valueNS = (__bridge NSString *)valueCF.get();
-
-    [[[mainFrame webView] preferences] _setStringPreferenceForTestingWithValue:valueNS forKey:keyNS];
-}
-
 void TestRunner::removeAllVisitedLinks()
 {
     [WebHistory _removeAllVisitedLinks];

Modified: trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp (269225 => 269226)


--- trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp	2020-10-31 16:08:51 UTC (rev 269226)
@@ -858,25 +858,6 @@
     viewPrivate->dispatchPendingLoadRequests();
 }
 
-void TestRunner::overridePreference(JSStringRef key, JSStringRef value)
-{
-    COMPtr<IWebView> webView;
-    if (FAILED(frame->webView(&webView)))
-        return;
-
-    COMPtr<IWebPreferences> preferences;
-    if (FAILED(webView->preferences(&preferences)))
-        return;
-
-    COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences);
-    if (!prefsPrivate)
-        return;
-
-    _bstr_t keyBSTR(JSStringCopyBSTR(key), false);
-    _bstr_t valueBSTR(JSStringCopyBSTR(value), false);
-    prefsPrivate->setPreferenceForTest(keyBSTR, valueBSTR);
-}
-
 void TestRunner::removeAllVisitedLinks()
 {
     COMPtr<IWebHistory> history;
@@ -1398,3 +1379,20 @@
 {
     fprintf(testResult, "ERROR: TestRunner::setSpellCheckerLoggingEnabled() not implemented\n");
 }
+
+void TestRunner::setShouldInvertColors(bool shouldInvertColors)
+{
+    COMPtr<IWebView> webView;
+    if (FAILED(frame->webView(&webView)))
+        return;
+
+    COMPtr<IWebPreferences> preferences;
+    if (FAILED(webView->preferences(&preferences)))
+        return;
+
+    COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences);
+    if (!prefsPrivate)
+        return;
+
+    prefsPrivate->setShouldInvertColors(shouldInvertColors);
+}

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (269225 => 269226)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2020-10-31 16:08:51 UTC (rev 269226)
@@ -197,8 +197,6 @@
     undefined setAlwaysAcceptCookies(boolean accept);
     undefined setOnlyAcceptFirstPartyCookies(boolean accept);
 
-    undefined overridePreference(DOMString preference, DOMString value);
-
     // Page Visibility API
     undefined setPageVisibility(DOMString state);
     undefined resetPageVisibility();

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (269225 => 269226)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2020-10-31 14:29:57 UTC (rev 269225)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2020-10-31 16:08:51 UTC (rev 269226)
@@ -846,21 +846,6 @@
     callTestRunnerCallback(SetBackingScaleFactorCallbackID);
 }
 
-static inline bool toBool(JSStringRef value)
-{
-    return JSStringIsEqualToUTF8CString(value, "true") || JSStringIsEqualToUTF8CString(value, "1");
-}
-
-void TestRunner::overridePreference(JSStringRef preference, JSStringRef value)
-{
-    auto& injectedBundle = InjectedBundle::singleton();
-    // Should use `<!-- webkit-test-runner [ enableBackForwardCache=true ] -->` instead.
-    RELEASE_ASSERT(!JSStringIsEqualToUTF8CString(preference, "WebKitUsesBackForwardCachePreferenceKey"));
-
-    // FIXME: handle non-boolean preferences.
-    WKBundleOverrideBoolPreferenceForTestRunner(injectedBundle.bundle(), injectedBundle.pageGroup(), toWK(preference).get(), toBool(value));
-}
-
 void TestRunner::setAlwaysAcceptCookies(bool accept)
 {
     postSynchronousMessage("SetAlwaysAcceptCookies", accept);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to