Diff
Modified: trunk/LayoutTests/ChangeLog (189668 => 189669)
--- trunk/LayoutTests/ChangeLog 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/LayoutTests/ChangeLog 2015-09-13 03:47:56 UTC (rev 189669)
@@ -1,3 +1,19 @@
+2015-09-12 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [Cocoa] Allow testing with the system language
+ https://bugs.webkit.org/show_bug.cgi?id=148671
+
+ Reviewed by Anders Carlsson and Alexey Proskuryakov.
+
+ Add a test for the declarative form of setting the system language.
+
+ * fast/text/international/system-language/declarative-language-expected.txt: Added.
+ * fast/text/international/system-language/declarative-language.html: Added.
+ * platform/efl/TestExpectations:
+ * platform/gtk/TestExpectations:
+ * platform/mac-wk1/TestExpectations:
+ * platform/mac/TestExpectations:
+
2015-09-12 Chris Dumez <cdu...@apple.com>
window.EventTarget should exist
Added: trunk/LayoutTests/fast/text/international/system-language/declarative-language-expected.txt (0 => 189669)
--- trunk/LayoutTests/fast/text/international/system-language/declarative-language-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/text/international/system-language/declarative-language-expected.txt 2015-09-13 03:47:56 UTC (rev 189669)
@@ -0,0 +1,8 @@
+PASS internals.userPreferredLanguages().length is 2
+PASS internals.userPreferredLanguages()[0].startsWith('ko') is true
+PASS internals.userPreferredLanguages()[1].startsWith('zh') is true
+PASS internals.userPreferredLanguages().length is 3
+PASS internals.userPreferredLanguages()[0] is "hi"
+PASS internals.userPreferredLanguages()[1] is "jp"
+PASS internals.userPreferredLanguages()[2] is "in"
+
Property changes on: trunk/LayoutTests/fast/text/international/system-language/declarative-language-expected.txt
___________________________________________________________________
Added: svn:keywords
Added: svn:eol-style
Added: trunk/LayoutTests/fast/text/international/system-language/declarative-language.html (0 => 189669)
--- trunk/LayoutTests/fast/text/international/system-language/declarative-language.html (rev 0)
+++ trunk/LayoutTests/fast/text/international/system-language/declarative-language.html 2015-09-13 03:47:56 UTC (rev 189669)
@@ -0,0 +1,21 @@
+<!DOCTYPE html><!-- webkit-test-runner [ language=ko,zh ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+if (window.internals) {
+ shouldBe("internals.userPreferredLanguages().length", "2");
+ shouldBeTrue("internals.userPreferredLanguages()[0].startsWith('ko')");
+ shouldBeTrue("internals.userPreferredLanguages()[1].startsWith('zh')");
+ internals.setUserPreferredLanguages(["hi", "jp", "in"]);
+ shouldBe("internals.userPreferredLanguages().length", "3");
+ shouldBeEqualToString("internals.userPreferredLanguages()[0]", "hi");
+ shouldBeEqualToString("internals.userPreferredLanguages()[1]", "jp");
+ shouldBeEqualToString("internals.userPreferredLanguages()[2]", "in");
+}
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/platform/efl/TestExpectations (189668 => 189669)
--- trunk/LayoutTests/platform/efl/TestExpectations 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/LayoutTests/platform/efl/TestExpectations 2015-09-13 03:47:56 UTC (rev 189669)
@@ -2548,3 +2548,6 @@
webkit.org/b/148470 svg/text/select-x-list-with-tspans-3.svg [ Failure ]
webkit.org/b/148470 svg/text/select-x-list-with-tspans-4.svg [ Failure ]
webkit.org/b/148470 svg/text/selection-doubleclick.svg [ Failure ]
+
+# Mocking the system language is not implemented in EFL.
+fast/text/international/system-language [ Failure ]
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (189668 => 189669)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2015-09-13 03:47:56 UTC (rev 189669)
@@ -2612,3 +2612,6 @@
# Media controls tests are OS X only
media/controls [ Skip ]
+
+# Mocking the system language is not implemented in GTK.
+fast/text/international/system-language [ Failure ]
Modified: trunk/LayoutTests/platform/mac/TestExpectations (189668 => 189669)
--- trunk/LayoutTests/platform/mac/TestExpectations 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2015-09-13 03:47:56 UTC (rev 189669)
@@ -1284,3 +1284,6 @@
# Colorspaces on CA OpenGL layers not available in Mavericks and Yosemite
[ Mavericks Yosemite ] fast/canvas/webgl/match-page-color-space.html [ Skip ]
+
+# Mocking the system language relies on Bootstrap XPC messages, which are not supported in Mavericks.
+[ Mavericks ] fast/text/international/system-language [ Failure ]
Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (189668 => 189669)
--- trunk/LayoutTests/platform/mac-wk1/TestExpectations 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations 2015-09-13 03:47:56 UTC (rev 189669)
@@ -141,3 +141,6 @@
# This test is WebKit2-only
http/tests/contentfiltering/load-substitute-data-from-appcache.html
+
+# Testing the system language declaratively only makes sense in WK2, because it's implemented in WebKitTestRunner by launching a new WebContent process.
+fast/text/international/system-language [ Failure ]
Modified: trunk/Source/WebKit2/ChangeLog (189668 => 189669)
--- trunk/Source/WebKit2/ChangeLog 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/Source/WebKit2/ChangeLog 2015-09-13 03:47:56 UTC (rev 189669)
@@ -1,3 +1,36 @@
+2015-09-12 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [Cocoa] Allow testing with the system language
+ https://bugs.webkit.org/show_bug.cgi?id=148671
+
+ Reviewed by Anders Carlsson and Alexey Proskuryakov.
+
+ This patch adds two new SPI functions for setting and retrieving a vector of
+ override languages to/from the WKContextConfiguration. The implementation of
+ these functions holds state inside WebProcessPoolConfiguration. Then, when
+ we launch a process, the WebProcessProxy will inject these override languages
+ into the ProcessLauncher::LaunchOptions so that the ProcessLauncher can
+ inject these languages into the XPC Bootstrap message. Then, in the Web
+ Process's main(), the XPC Boostrap message is read, and the platform
+ languages are set via NSUserDefaults setting a volatile domain.
+
+ * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm:
+ (main): Set the volatile domain with NSUserDefaults.
+ * UIProcess/API/APIProcessPoolConfiguration.cpp:
+ (API::ProcessPoolConfiguration::copy):
+ * UIProcess/API/APIProcessPoolConfiguration.h: Hold state for the override
+ languages.
+ * UIProcess/API/C/WKContextConfigurationRef.cpp:
+ (WKContextConfigurationCopyOverrideLanguages): SPI.
+ (WKContextConfigurationSetOverrideLanguages): Ditto.
+ * UIProcess/API/C/WKContextConfigurationRef.h:
+ * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+ (WebKit::connectToService): Inject the languages into the XPC Bootstrap
+ message.
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::getLaunchOptions): Inject the override languages
+ into the ProcessLauncher::LaunchOptions.
+
2015-09-12 Alexey Proskuryakov <a...@apple.com>
[iOS] Allow UDP networking
Modified: trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm (189668 => 189669)
--- trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm 2015-09-13 03:47:56 UTC (rev 189669)
@@ -32,6 +32,7 @@
#import <stdio.h>
#import <stdlib.h>
#import <wtf/OSObjectPtr.h>
+#import <wtf/RetainPtr.h>
#import <wtf/spi/darwin/XPCSPI.h>
namespace WebKit {
@@ -159,6 +160,22 @@
int main(int argc, char** argv)
{
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ if (auto bootstrap = adoptOSObject(xpc_copy_bootstrap())) {
+ if (xpc_object_t languages = xpc_dictionary_get_value(bootstrap.get(), "OverrideLanguages")) {
+ NSDictionary *existingArguments = [[NSUserDefaults standardUserDefaults] volatileDomainForName:NSArgumentDomain];
+ NSMutableDictionary *newArguments = [existingArguments mutableCopy];
+ RetainPtr<NSMutableArray *> newLanguages = adoptNS([[NSMutableArray alloc] init]);
+ xpc_array_apply(languages, ^(size_t index, xpc_object_t value) {
+ [newLanguages addObject:[NSString stringWithCString:xpc_string_get_string_ptr(value) encoding:NSUTF8StringEncoding]];
+ return true;
+ });
+ [newArguments setValue:newLanguages.get() forKey:@"AppleLanguages"];
+ [[NSUserDefaults standardUserDefaults] setVolatileDomain:newArguments forName:NSArgumentDomain];
+ }
+ }
+#endif
+
#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
Modified: trunk/Source/WebKit2/UIProcess/API/APIProcessPoolConfiguration.cpp (189668 => 189669)
--- trunk/Source/WebKit2/UIProcess/API/APIProcessPoolConfiguration.cpp 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/Source/WebKit2/UIProcess/API/APIProcessPoolConfiguration.cpp 2015-09-13 03:47:56 UTC (rev 189669)
@@ -88,6 +88,7 @@
copy->m_webSQLDatabaseDirectory = this->m_webSQLDatabaseDirectory;
copy->m_cachePartitionedURLSchemes = this->m_cachePartitionedURLSchemes;
copy->m_fullySynchronousModeIsAllowedForTesting = this->m_fullySynchronousModeIsAllowedForTesting;
+ copy->m_overrideLanguages = this->m_overrideLanguages;
return copy;
}
Modified: trunk/Source/WebKit2/UIProcess/API/APIProcessPoolConfiguration.h (189668 => 189669)
--- trunk/Source/WebKit2/UIProcess/API/APIProcessPoolConfiguration.h 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/Source/WebKit2/UIProcess/API/APIProcessPoolConfiguration.h 2015-09-13 03:47:56 UTC (rev 189669)
@@ -90,6 +90,9 @@
bool fullySynchronousModeIsAllowedForTesting() const { return m_fullySynchronousModeIsAllowedForTesting; }
void setFullySynchronousModeIsAllowedForTesting(bool allowed) { m_fullySynchronousModeIsAllowedForTesting = allowed; }
+ const Vector<WTF::String>& overrideLanguages() const { return m_overrideLanguages; }
+ void setOverrideLanguages(Vector<WTF::String>&& languages) { m_overrideLanguages = WTF::move(languages); }
+
private:
bool m_shouldHaveLegacyDataStore { false };
@@ -108,6 +111,7 @@
WTF::String m_mediaKeysStorageDirectory;
Vector<WTF::String> m_cachePartitionedURLSchemes;
bool m_fullySynchronousModeIsAllowedForTesting { false };
+ Vector<WTF::String> m_overrideLanguages;
};
} // namespace API
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.cpp (189668 => 189669)
--- trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.cpp 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.cpp 2015-09-13 03:47:56 UTC (rev 189669)
@@ -121,3 +121,13 @@
{
toImpl(configuration)->setFullySynchronousModeIsAllowedForTesting(allowed);
}
+
+WKArrayRef WKContextConfigurationCopyOverrideLanguages(WKContextConfigurationRef configuration)
+{
+ return toAPI(&API::Array::createStringArray(toImpl(configuration)->overrideLanguages()).leakRef());
+}
+
+void WKContextConfigurationSetOverrideLanguages(WKContextConfigurationRef configuration, WKArrayRef overrideLanguages)
+{
+ toImpl(configuration)->setOverrideLanguages(toImpl(overrideLanguages)->toStringVector());
+}
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.h (189668 => 189669)
--- trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.h 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.h 2015-09-13 03:47:56 UTC (rev 189669)
@@ -58,6 +58,9 @@
WK_EXPORT bool WKContextConfigurationFullySynchronousModeIsAllowedForTesting(WKContextConfigurationRef configuration);
WK_EXPORT void WKContextConfigurationSetFullySynchronousModeIsAllowedForTesting(WKContextConfigurationRef configuration, bool allowed);
+WK_EXPORT WKArrayRef WKContextConfigurationCopyOverrideLanguages(WKContextConfigurationRef configuration);
+WK_EXPORT void WKContextConfigurationSetOverrideLanguages(WKContextConfigurationRef configuration, WKArrayRef overrideLanguages);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm (189668 => 189669)
--- trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm 2015-09-13 03:47:56 UTC (rev 189669)
@@ -243,6 +243,17 @@
xpc_dictionary_set_string(containerEnvironmentVariables.get(), "TMPDIR", environmentTMPDIR);
xpc_dictionary_set_value(initializationMessage.get(), "ContainerEnvironmentVariables", containerEnvironmentVariables.get());
#endif
+
+ auto languagesIterator = launchOptions.extraInitializationData.find("OverrideLanguages");
+ if (languagesIterator != launchOptions.extraInitializationData.end()) {
+ auto languages = adoptOSObject(xpc_array_create(nullptr, 0));
+ Vector<String> languageVector;
+ languagesIterator->value.split(",", false, languageVector);
+ for (auto& language : languageVector)
+ xpc_array_set_string(languages.get(), XPC_ARRAY_APPEND, language.utf8().data());
+ xpc_dictionary_set_value(initializationMessage.get(), "OverrideLanguages", languages.get());
+ }
+
xpc_connection_set_bootstrap(connection.get(), initializationMessage.get());
#endif
Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (189668 => 189669)
--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp 2015-09-13 03:47:56 UTC (rev 189669)
@@ -129,8 +129,21 @@
void WebProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions)
{
launchOptions.processType = ProcessLauncher::WebProcess;
+
if (WebInspectorProxy::isInspectorProcessPool(m_processPool))
launchOptions.extraInitializationData.add(ASCIILiteral("inspector-process"), ASCIILiteral("1"));
+
+ auto overrideLanguages = m_processPool->configuration().overrideLanguages();
+ if (overrideLanguages.size()) {
+ StringBuilder languageString;
+ for (size_t i = 0; i < overrideLanguages.size(); ++i) {
+ if (i)
+ languageString.append(',');
+ languageString.append(overrideLanguages[i]);
+ }
+ launchOptions.extraInitializationData.add(ASCIILiteral("OverrideLanguages"), languageString.toString());
+ }
+
platformGetLaunchOptions(launchOptions);
}
Modified: trunk/Tools/ChangeLog (189668 => 189669)
--- trunk/Tools/ChangeLog 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/Tools/ChangeLog 2015-09-13 03:47:56 UTC (rev 189669)
@@ -1,5 +1,30 @@
2015-09-12 Myles C. Maxfield <mmaxfi...@apple.com>
+ [Cocoa] Allow testing with the system language
+ https://bugs.webkit.org/show_bug.cgi?id=148671
+
+ Reviewed by Anders Carlsson and Alexey Proskuryakov.
+
+ React to tests marked with language=lang1,lang2,etc in their header.
+ Once this information is parsed, pass it to
+ WKContextConfigurationSetOverrideLanguages().
+
+ * WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm:
+ (WTR::InjectedBundle::platformInitialize): Don't clobber the language
+ list.
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::createWebViewWithOptions): Call
+ WKContextConfigurationSetOverrideLanguages().
+ (WTR::updateTestOptionsFromTestHeader): Inspect the language option.
+ * WebKitTestRunner/TestOptions.h:
+ * WebKitTestRunner/ios/PlatformWebViewIOS.mm:
+ (WTR::PlatformWebView::viewSupportsOptions): Cause a differing language
+ option to restart the web process.
+ * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+ (WTR::PlatformWebView::viewSupportsOptions): Ditto.
+
+2015-09-12 Myles C. Maxfield <mmaxfi...@apple.com>
+
[WKTR] Allow changing the WKContextConfiguration between successive tests
https://bugs.webkit.org/show_bug.cgi?id=148833
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm (189668 => 189669)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm 2015-09-13 03:47:56 UTC (rev 189669)
@@ -42,6 +42,11 @@
static const int NoFontSmoothing = 0;
static const int BlueTintedAppearance = 1;
+ // Language was set up earlier in main(). Don't clobber it.
+ NSArray *languages = [[[NSUserDefaults standardUserDefaults] volatileDomainForName:NSArgumentDomain] valueForKey:@"AppleLanguages"];
+ if (!languages)
+ languages = @[ @"en" ];
+
NSDictionary *dict = @{
@"AppleAntiAliasingThreshold": @4,
// FIXME: Setting AppleFontSmoothing is likely unnecessary and ineffective. WebKit2 has its own preference for font smoothing, which is
@@ -56,7 +61,7 @@
@"NSButtonAnimationsEnabled": @NO, // Ideally, we should find a way to test animations, but for now, make sure that the dumped snapshot matches actual state.
// FIXME (<rdar://problem/13396515>): It is too late to set AppleLanguages here, as loaded frameworks localizations cannot be changed.
// This breaks some accessibility tests on machines with non-English user language.
- @"AppleLanguages": @[ @"en" ],
+ @"AppleLanguages": languages,
@"NSPreferredSpellServerLanguage": @"en_US",
@"NSUserDictionaryReplacementItems": @[],
@"NSTestCorrectionDictionary": @{
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (189668 => 189669)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2015-09-13 03:47:56 UTC (rev 189669)
@@ -463,7 +463,12 @@
void TestController::createWebViewWithOptions(const TestOptions& options)
{
auto contextConfiguration = generateContextConfiguration();
- // Modify contextConfiguration here.
+
+ WKRetainPtr<WKMutableArrayRef> overrideLanguages = adoptWK(WKMutableArrayCreate());
+ for (auto& language : options.overrideLanguages)
+ WKArrayAppendItem(overrideLanguages.get(), adoptWK(WKStringCreateWithUTF8CString(language.utf8().data())).get());
+ WKContextConfigurationSetOverrideLanguages(contextConfiguration.get(), overrideLanguages.get());
+
auto configuration = generatePageConfiguration(contextConfiguration.get());
// Some preferences (notably mock scroll bars setting) currently cannot be re-applied to an existing view, so we need to set them now.
@@ -856,7 +861,8 @@
}
auto key = pairString.substr(pairStart, equalsLocation - pairStart);
auto value = pairString.substr(equalsLocation + 1, pairEnd - (equalsLocation + 1));
- // Options processing to modify testOptions goes here.
+ if (key == "language")
+ String(value.c_str()).split(",", false, testOptions.overrideLanguages);
pairStart = pairEnd + 1;
}
}
Modified: trunk/Tools/WebKitTestRunner/TestOptions.h (189668 => 189669)
--- trunk/Tools/WebKitTestRunner/TestOptions.h 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/Tools/WebKitTestRunner/TestOptions.h 2015-09-13 03:47:56 UTC (rev 189669)
@@ -26,6 +26,9 @@
#ifndef TestOptions_h
#define TestOptions_h
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
namespace WTR {
struct TestOptions {
@@ -34,6 +37,7 @@
bool shouldShowWebView { false };
bool useFixedLayout { false };
+ Vector<String> overrideLanguages;
};
}
Modified: trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm (189668 => 189669)
--- trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm 2015-09-13 03:47:56 UTC (rev 189669)
@@ -204,6 +204,9 @@
bool PlatformWebView::viewSupportsOptions(const TestOptions& options) const
{
+ if (m_options.overrideLanguages != options.overrideLanguages)
+ return false;
+
return true;
}
Modified: trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm (189668 => 189669)
--- trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm 2015-09-13 02:31:34 UTC (rev 189668)
+++ trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm 2015-09-13 03:47:56 UTC (rev 189669)
@@ -242,7 +242,7 @@
bool PlatformWebView::viewSupportsOptions(const TestOptions& options) const
{
- if (m_options.useThreadedScrolling != options.useThreadedScrolling)
+ if (m_options.useThreadedScrolling != options.useThreadedScrolling || m_options.overrideLanguages != options.overrideLanguages)
return false;
return true;