Skip to content
Permalink
Browse files
REGRESSION(r263094): [GTK][WPE] API test /webkit/WebKitWebContext/lan…
…guages is failing

https://bugs.webkit.org/show_bug.cgi?id=188111

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2021-03-02
Reviewed by Michael Catanzaro.

Source/WebKit:

The GLib API allows to change the user preferred languages after the web process is created. Since r263094 we
are no loner sending the new overrides to the web process. Instead of calling overrideUserPreferredLanguages()
we now set the overrides in the WebProcessPool configuration, so that we can remove the language observer.

* UIProcess/API/glib/WebKitWebContext.cpp:
(webkit_web_context_set_preferred_languages): Use WebProcessPool::setOverrideLanguages() instead of
overrideUserPreferredLanguages().
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::WebProcessPool) Remove the language observer registration.
(WebKit::WebProcessPool::~WebProcessPool): Remove the language observer unregistration.
(WebKit::WebProcessPool::setOverrideLanguages): Update the language overrides in the configuration and notify
all processes.
(WebKit::WebProcessPool::languageChanged): Deleted.
* UIProcess/WebProcessPool.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::userPreferredLanguagesChanged const): Call overrideUserPreferredLanguages() again here.
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:

Tools:

* TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp:
(testWebContextLanguages): Invalid locale is ignored now instead of throwing a exception.
* TestWebKitAPI/glib/TestExpectations.json: Remove test expectation now that it passes again.

Canonical link: https://commits.webkit.org/234750@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273735 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
carlosgcampos authored and webkit-commit-queue committed Mar 2, 2021
1 parent 33fe757 commit 8078504297dbdb6d3d862f5ea4895ff6c7f9671d
Showing 10 changed files with 53 additions and 27 deletions.
@@ -1,3 +1,29 @@
2021-03-02 Carlos Garcia Campos <cgarcia@igalia.com>

REGRESSION(r263094): [GTK][WPE] API test /webkit/WebKitWebContext/languages is failing
https://bugs.webkit.org/show_bug.cgi?id=188111

Reviewed by Michael Catanzaro.

The GLib API allows to change the user preferred languages after the web process is created. Since r263094 we
are no loner sending the new overrides to the web process. Instead of calling overrideUserPreferredLanguages()
we now set the overrides in the WebProcessPool configuration, so that we can remove the language observer.

* UIProcess/API/glib/WebKitWebContext.cpp:
(webkit_web_context_set_preferred_languages): Use WebProcessPool::setOverrideLanguages() instead of
overrideUserPreferredLanguages().
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::WebProcessPool) Remove the language observer registration.
(WebKit::WebProcessPool::~WebProcessPool): Remove the language observer unregistration.
(WebKit::WebProcessPool::setOverrideLanguages): Update the language overrides in the configuration and notify
all processes.
(WebKit::WebProcessPool::languageChanged): Deleted.
* UIProcess/WebProcessPool.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::userPreferredLanguagesChanged const): Call overrideUserPreferredLanguages() again here.
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:

2021-03-02 Youenn Fablet <youenn@apple.com>

Use capture settings after recovering capture from GPUProcess
@@ -65,7 +65,6 @@
#include <wtf/FileSystem.h>
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/Language.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
@@ -1463,7 +1462,7 @@ void webkit_web_context_set_preferred_languages(WebKitWebContext* context, const
else
languages.append(String::fromUTF8(languageList[i]).replace("_", "-"));
}
overrideUserPreferredLanguages(languages);
context->priv->processPool->setOverrideLanguages(WTFMove(languages));
}

/**
@@ -96,7 +96,6 @@
#include <WebCore/RuntimeApplicationChecks.h>
#include <pal/SessionID.h>
#include <wtf/CallbackAggregator.h>
#include <wtf/Language.h>
#include <wtf/MainThread.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/ProcessPrivilege.h>
@@ -305,8 +304,6 @@ WebProcessPool::WebProcessPool(API::ProcessPoolConfiguration& configuration)

processPools().append(this);

addLanguageChangeObserver(this, languageChanged);

resolvePathsForSandboxExtensions();

#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
@@ -336,8 +333,6 @@ WebProcessPool::~WebProcessPool()
bool removed = processPools().removeFirst(this);
ASSERT_UNUSED(removed, removed);

removeLanguageChangeObserver(this);

m_messageReceiverMap.invalidate();

for (auto& supplement : m_supplements.values()) {
@@ -417,17 +412,14 @@ void WebProcessPool::setCustomWebContentServiceBundleIdentifier(const String& cu
m_configuration->setCustomWebContentServiceBundleIdentifier(customWebContentServiceBundleIdentifier);
}

void WebProcessPool::languageChanged(void* context)
void WebProcessPool::setOverrideLanguages(Vector<String>&& languages)
{
static_cast<WebProcessPool*>(context)->languageChanged();
}
m_configuration->setOverrideLanguages(WTFMove(languages));

void WebProcessPool::languageChanged()
{
sendToAllProcesses(Messages::WebProcess::UserPreferredLanguagesChanged());
sendToAllProcesses(Messages::WebProcess::UserPreferredLanguagesChanged(m_configuration->overrideLanguages()));
#if USE(SOUP)
for (auto networkProcess : NetworkProcessProxy::allNetworkProcesses())
networkProcess->send(Messages::NetworkProcess::UserPreferredLanguagesChanged(userPreferredLanguages()), 0);
networkProcess->send(Messages::NetworkProcess::UserPreferredLanguagesChanged(m_configuration->overrideLanguages()), 0);
#endif
}

@@ -487,7 +487,9 @@ class WebProcessPool final

void setJavaScriptConfigurationDirectory(String&& directory) { m_javaScriptConfigurationDirectory = directory; }
const String& javaScriptConfigurationDirectory() const { return m_javaScriptConfigurationDirectory; }


void setOverrideLanguages(Vector<String>&&);

WebProcessDataStoreParameters webProcessDataStoreParameters(WebProcessProxy&, WebsiteDataStore&);

static void setUseSeparateServiceWorkerProcess(bool);
@@ -545,9 +547,6 @@ class WebProcessPool final
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override;

static void languageChanged(void* context);
void languageChanged();

bool usesSingleWebProcess() const { return m_configuration->usesSingleWebProcess(); }

#if PLATFORM(COCOA)
@@ -682,9 +682,9 @@ void WebProcess::setShouldUseFontSmoothing(bool useFontSmoothing)
WebCore::FontCascade::setShouldUseSmoothing(useFontSmoothing);
}

void WebProcess::userPreferredLanguagesChanged() const
void WebProcess::userPreferredLanguagesChanged(const Vector<String>& languages) const
{
WTF::languageDidChange();
overrideUserPreferredLanguages(languages);
}

void WebProcess::fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled)
@@ -418,7 +418,7 @@ class WebProcess : public AuxiliaryProcess
void clearResourceLoadStatistics();
void flushResourceLoadStatistics();
void seedResourceLoadStatisticsForTesting(const WebCore::RegistrableDomain& firstPartyDomain, const WebCore::RegistrableDomain& thirdPartyDomain, bool shouldScheduleNotification, CompletionHandler<void()>&&);
void userPreferredLanguagesChanged() const;
void userPreferredLanguagesChanged(const Vector<String>&) const;
void fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled);

void platformSetCacheModel(CacheModel);
@@ -47,7 +47,7 @@ messages -> WebProcess LegacyReceiver NotRefCounted {
SetShouldUseFontSmoothing(bool useFontSmoothing)
SetResourceLoadStatisticsEnabled(bool resourceLoadStatisticsEnabled);
ClearResourceLoadStatistics();
UserPreferredLanguagesChanged()
UserPreferredLanguagesChanged(Vector<String> languages)
FullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled)

#if HAVE(UIKIT_WITH_MOUSE_SUPPORT) && PLATFORM(IOS)
@@ -1,3 +1,14 @@
2021-03-02 Carlos Garcia Campos <cgarcia@igalia.com>

REGRESSION(r263094): [GTK][WPE] API test /webkit/WebKitWebContext/languages is failing
https://bugs.webkit.org/show_bug.cgi?id=188111

Reviewed by Michael Catanzaro.

* TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp:
(testWebContextLanguages): Invalid locale is ignored now instead of throwing a exception.
* TestWebKitAPI/glib/TestExpectations.json: Remove test expectation now that it passes again.

2021-03-02 Aakash Jain <aakash_jain@apple.com>

[build.webkit.org] Enable grid view
@@ -379,12 +379,14 @@ static void testWebContextLanguages(WebViewTest* test, gconstpointer)
locale.reset(WebViewTest::javascriptResultToCString(javascriptResult));
g_assert_cmpstr(locale.get(), ==, expectedDefaultLanguage);

// An invalid locale should throw an exception.
// An invalid locale should not be used.
const char* invalidLanguage[] = { "A", nullptr };
webkit_web_context_set_preferred_languages(test->m_webContext.get(), invalidLanguage);
javascriptResult = test->runJavaScriptAndWaitUntilFinished("Intl.DateTimeFormat().resolvedOptions().locale", &error.outPtr());
g_assert_nonnull(javascriptResult);
g_assert_error(error.get(), WEBKIT_JAVASCRIPT_ERROR, WEBKIT_JAVASCRIPT_ERROR_SCRIPT_FAILED);
g_assert_no_error(error.get());
locale.reset(WebViewTest::javascriptResultToCString(javascriptResult));
g_assert_cmpstr(locale.get(), !=, "A");
}

#if USE(SOUP2)
@@ -111,9 +111,6 @@
"/webkit/WebKitWebContext/uri-scheme": {
"expected": {"all": {"status": ["FAIL", "PASS"], "bug": "webkit.org/b/183183"}}
},
"/webkit/WebKitWebContext/languages": {
"expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/188111"}}
},
"/webkit/WebKitWebContext/proxy": {
"expected": {"all": {"status": ["FAIL", "PASS"], "bug": "webkit.org/b/222090"}}
}

0 comments on commit 8078504

Please sign in to comment.