From 999f8a2efa6814700e9dae2492580195a1a39a54 Mon Sep 17 00:00:00 2001 From: HaseenaSainul Date: Fri, 15 Mar 2024 01:16:47 -0400 Subject: [PATCH] WebKit syncup changes --- WebKitBrowser/CMakeLists.txt | 33 ++++--- WebKitBrowser/CookieJar.cpp | 37 +++----- WebKitBrowser/Extension/CMakeLists.txt | 2 + WebKitBrowser/Extension/IIdentifier.cpp | 10 +++ WebKitBrowser/Extension/ProcessInfo.cpp | 50 ----------- WebKitBrowser/Extension/ProcessInfo.h | 30 ------- WebKitBrowser/Extension/main.cpp | 8 +- .../WhiteListedOriginDomainsList.cpp | 1 + WebKitBrowser/InjectedBundle/main.cpp | 7 ++ WebKitBrowser/WebKitBrowser.cpp | 65 ++++++++++---- WebKitBrowser/WebKitBrowser.h | 26 ------ WebKitBrowser/WebKitBrowserJsonRpc.cpp | 42 --------- WebKitBrowser/WebKitImplementation.cpp | 89 ++++++++++++++++--- 13 files changed, 188 insertions(+), 212 deletions(-) delete mode 100644 WebKitBrowser/Extension/ProcessInfo.cpp delete mode 100644 WebKitBrowser/Extension/ProcessInfo.h diff --git a/WebKitBrowser/CMakeLists.txt b/WebKitBrowser/CMakeLists.txt index 05a8b44fea..e474836a60 100644 --- a/WebKitBrowser/CMakeLists.txt +++ b/WebKitBrowser/CMakeLists.txt @@ -20,8 +20,9 @@ project(WebKitBrowser) cmake_minimum_required(VERSION 3.3) find_package(WPEFramework) +project_version(1.0.0) -set(PLUGIN_NAME WebKitBrowser) +#set(PLUGIN_NAME WebKitBrowser) set(MODULE_NAME ${NAMESPACE}${PROJECT_NAME}) message("Setup ${MODULE_NAME} v${PROJECT_VERSION}") @@ -344,51 +345,61 @@ else() set(PLUGIN_YOUTUBE_WIDTH ${PLUGIN_WEBKITBROWSER_WIDTH}) endif() -write_config( ${PLUGIN_NAME} ) +write_config() +#write_config( ${PLUGIN_NAME} ) # youtube configuration if(PLUGIN_WEBKITBROWSER_YOUTUBE) - write_config( YouTube ) + write_config( PLUGINS YouTube ) +# write_config( YouTube ) endif() # amazon configuration if(PLUGIN_AMAZON_HYBRID) - write_config( Amazon ) + write_config( PLUGINS Amazon ) +# write_config( Amazon ) endif() # Applications instance configuration if(PLUGIN_WEBKITBROWSER_APPS) - write_config( Apps ) + write_config( PLUGINS Apps ) +# write_config( Apps ) endif() # UX configuration if(PLUGIN_WEBKITBROWSER_UX) - write_config( UX ) + write_config( PLUGINS UX ) +# write_config( UX ) endif() # Search&Discovery configuration if(PLUGIN_WEBKITBROWSER_SEARCH_AND_DISCOVERY_APP) - write_config( SearchAndDiscoveryApp ) + write_config( PLUGINS SearchAndDiscoveryApp ) +# write_config( SearchAndDiscoveryApp ) endif() # Html App configuration if(PLUGIN_WEBKITBROWSER_HTML_APP) - write_config( HtmlApp ) + write_config( PLUGINS HtmlApp ) +# write_config( HtmlApp ) endif() # Lightning App configuration if(PLUGIN_WEBKITBROWSER_LIGHTNING_APP) - write_config( LightningApp ) + write_config( PLUGINS LightningApp ) +# write_config( LightningApp ) endif() # JSPP configuration if(PLUGIN_WEBKITBROWSER_JSPP) - write_config( JSPP ) + write_config( PLUGINS JSPP ) +# write_config( JSPP ) endif() # Resident App configuration if(PLUGIN_WEBKITBROWSER_RESIDENT_APP) - write_config( ResidentApp ) + write_config( PLUGINS ResidentApp ) +# write_config( ResidentApp ) endif() if(PLUGINS_CREATE_IPKG_TARGETS) diff --git a/WebKitBrowser/CookieJar.cpp b/WebKitBrowser/CookieJar.cpp index 432a9d6480..6f9719c0b7 100644 --- a/WebKitBrowser/CookieJar.cpp +++ b/WebKitBrowser/CookieJar.cpp @@ -48,8 +48,7 @@ static void deserialize(const std::string& cookies, std::vector& re { std::string cookie; std::stringstream ss(cookies); - while(ss.good()) - { + while (ss.good()) { getline(ss, cookie, '\n'); if (!cookie.empty()) result.push_back(cookie); @@ -83,16 +82,14 @@ static std::vector compress(const std::string& str) { std::vector result; size_t nbytes = str.size(); - if (nbytes == 0) - { + if (nbytes == 0) { result.resize(4, '\0'); return result; } const int compressionLevel = 1; unsigned long len = nbytes + nbytes / 100 + 13; int status; - do - { + do { result.resize(len + 4); status = ::compress2((unsigned char*)result.data() + 4, &len, (const unsigned char*)str.c_str(), nbytes, compressionLevel); @@ -122,10 +119,8 @@ static std::string uncompress(const std::vector& in) { std::string result; size_t nbytes = in.size(); - if (nbytes <= 4) - { - if (nbytes < 4 || std::any_of(in.cbegin(), in.cend(), [](int v) {return v != 0;})) - { + if (nbytes <= 4) { + if (nbytes < 4 || std::any_of(in.cbegin(), in.cend(), [](int v) {return v != 0;})) { TRACE_GLOBAL(Trace::Error,(_T("Input data is corrupted"))); } return result; @@ -136,8 +131,7 @@ static std::string uncompress(const std::vector& in) (data[2] << 8) | (data[3])); unsigned long len = std::max(expectedSize, 1ul); int status; - do - { + do { result.resize(len); status = ::uncompress((unsigned char*)result.data(), &len, data + 4, nbytes - 4); switch (status) @@ -172,8 +166,7 @@ static uint32_t crc_checksum(const std::string& str) unsigned char c = 0; const unsigned char *p = (const unsigned char*) str.data(); size_t len = str.size(); - while (len--) - { + while (len--) { c = *p++; crc = ((crc >> 4) & 0x0fff) ^ crc_tbl[((crc ^ c) & 15)]; c >>= 4; @@ -199,12 +192,9 @@ struct CookieJar::CookieJarPrivate rc = _cookieJarCrypto.Encrypt(compress(serialized), version, encrypted); - if (rc != Core::ERROR_NONE) - { + if (rc != Core::ERROR_NONE) { TRACE_GLOBAL(Trace::Error,(_T("Encryption failed, rc = %u"), rc)); - } - else - { + } else { payload = toBase64(encrypted); } @@ -225,17 +215,14 @@ struct CookieJar::CookieJarPrivate else { std::string serialized; - int actualChecksum; + uint32_t actualChecksum; serialized = uncompress(decrypted); actualChecksum = crc_checksum(serialized); - if (actualChecksum != checksum) - { + if (actualChecksum != checksum) { rc = Core::ERROR_GENERAL; TRACE_GLOBAL(Trace::Error,(_T("Checksum does not match: actual=%d expected=%d"), actualChecksum, checksum)); - } - else - { + } else { deserialize(serialized, cookies); } } diff --git a/WebKitBrowser/Extension/CMakeLists.txt b/WebKitBrowser/Extension/CMakeLists.txt index 2a07deccf7..c304998d5f 100644 --- a/WebKitBrowser/Extension/CMakeLists.txt +++ b/WebKitBrowser/Extension/CMakeLists.txt @@ -79,6 +79,7 @@ set_target_properties(${MODULE_NAME} PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED YES) +target_compile_options (${MODULE_NAME} PRIVATE -Wno-psabi) target_link_libraries(${MODULE_NAME} PRIVATE @@ -89,5 +90,6 @@ target_link_libraries(${MODULE_NAME} target_compile_definitions(${MODULE_NAME} PRIVATE WEBKIT_GLIB_API) install(TARGETS ${MODULE_NAME} + PERMISSIONS OWNER_READ GROUP_READ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/${NAMESPACE}/WebKitBrowser/${PLUGIN_WEBKITBROWSER_EXTENSION_DIRECTORY} COMPONENT ${PROJECT_NAME}) diff --git a/WebKitBrowser/Extension/IIdentifier.cpp b/WebKitBrowser/Extension/IIdentifier.cpp index 2a8c39a974..b66966c838 100644 --- a/WebKitBrowser/Extension/IIdentifier.cpp +++ b/WebKitBrowser/Extension/IIdentifier.cpp @@ -45,8 +45,11 @@ void InjectJS(WebKitScriptWorld* world, WebKitFrame* frame, Core::ProxyType(userData); PluginHost::IShell* controller = std::get<0>(identifierData); + ASSERT(controller != nullptr); const PluginHost::ISubSystem* subsysInterface = std::get<1>(identifierData); + ASSERT(subsysInterface != nullptr); const PluginHost::ISubSystem::IIdentifier* identifierInterface = std::get<2>(identifierData); + ASSERT(identifierInterface != nullptr); identifierInterface->Release(); subsysInterface->Release(); @@ -61,9 +64,12 @@ void InjectJS(WebKitScriptWorld* world, WebKitFrame* frame, Core::ProxyType gpointer { Core::ProxyType& comClient = *static_cast*>(userData); + ASSERT(comClient != nullptr); PluginHost::IShell* controller = comClient->Acquire(10000, _T("Controller"), ~0); + ASSERT(controller != nullptr); const PluginHost::ISubSystem* subsysInterface = controller->SubSystems(); + ASSERT(subsysInterface != nullptr); const PluginHost::ISubSystem::IIdentifier* identifierInterface = subsysInterface->Get(); auto* identifierData = new IIdentifierData(controller, subsysInterface, identifierInterface); @@ -84,6 +90,7 @@ void InjectJS(WebKitScriptWorld* world, WebKitFrame* frame, Core::ProxyType char* { IIdentifierData& identifierData = *static_cast(userData); const PluginHost::ISubSystem::IIdentifier* identifierInterface = std::get<2>(identifierData); + ASSERT(identifierInterface != nullptr); uint8_t buffer[64] = {}; buffer[0] = identifierInterface->Identifier(sizeof(buffer) - 1, &(buffer[1])); @@ -106,6 +113,7 @@ void InjectJS(WebKitScriptWorld* world, WebKitFrame* frame, Core::ProxyType char* { IIdentifierData& identifierData = *static_cast(userData); const PluginHost::ISubSystem::IIdentifier* identifierInterface = std::get<2>(identifierData); + ASSERT(identifierInterface != nullptr); string architecture = identifierInterface->Architecture(); if (architecture.length() > 0) { @@ -126,6 +134,7 @@ void InjectJS(WebKitScriptWorld* world, WebKitFrame* frame, Core::ProxyType char* { IIdentifierData& identifierData = *static_cast(userData); const PluginHost::ISubSystem::IIdentifier* identifierInterface = std::get<2>(identifierData); + ASSERT(identifierInterface != nullptr); string chipset = identifierInterface->Chipset(); if (chipset.length() > 0) { @@ -146,6 +155,7 @@ void InjectJS(WebKitScriptWorld* world, WebKitFrame* frame, Core::ProxyType char* { IIdentifierData& identifierData = *static_cast(userData); const PluginHost::ISubSystem::IIdentifier* identifierInterface = std::get<2>(identifierData); + ASSERT(identifierInterface != nullptr); string firmwareVersion = identifierInterface->FirmwareVersion(); if (firmwareVersion.length() > 0) { diff --git a/WebKitBrowser/Extension/ProcessInfo.cpp b/WebKitBrowser/Extension/ProcessInfo.cpp deleted file mode 100644 index 999e072ee4..0000000000 --- a/WebKitBrowser/Extension/ProcessInfo.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * If not stated otherwise in this file or this component's LICENSE file the - * following copyright and licenses apply: - * - * Copyright 2023 RDK Management - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Module.h" - -#include - -namespace WPEFramework { -namespace ProcessInfo { - -void SetProcessName() -{ - std::string processName; - - Core::SystemInfo::GetEnvironment(std::string(_T("PROCESS_NAME")), processName); - - if (processName.empty()) { - return; - } - -#ifdef __LINUX__ - int ret = prctl(PR_SET_NAME, processName.c_str()); -#else - #error("No implementation available to set process name on this platform") -#endif - if (0 != ret ) { - TRACE_GLOBAL(Trace::Error, (_T("Setting process name to '%s' FAILED with code %d\n"), processName.c_str(), ret)); - } else { - TRACE_GLOBAL(Trace::Error, (_T("Setting process name to '%s' SUCCESS\n"), processName.c_str())); - } -} - -} // namespace ProcessInfo -} // namespace WPEFramework diff --git a/WebKitBrowser/Extension/ProcessInfo.h b/WebKitBrowser/Extension/ProcessInfo.h deleted file mode 100644 index 2949013bd2..0000000000 --- a/WebKitBrowser/Extension/ProcessInfo.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * If not stated otherwise in this file or this component's LICENSE file the - * following copyright and licenses apply: - * - * Copyright 2023 RDK Management - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -namespace WPEFramework { -namespace ProcessInfo { - -void SetProcessName(); - -} // namespace ProcessInfo -} // namespace WPEFramework diff --git a/WebKitBrowser/Extension/main.cpp b/WebKitBrowser/Extension/main.cpp index 5288ce2020..6a03630ca6 100644 --- a/WebKitBrowser/Extension/main.cpp +++ b/WebKitBrowser/Extension/main.cpp @@ -73,8 +73,11 @@ static class PluginHost { PluginHost() : _engine(Core::ProxyType>::Create()) , _comClient(Core::ProxyType::Create(GetConnectionNode(), Core::ProxyType(_engine))) + , _extension(nullptr) { +#ifndef USE_THUNDER_R4 _engine->Announcements(_comClient->Announcement()); +#endif } ~PluginHost() { @@ -85,6 +88,7 @@ static class PluginHost { public: void Initialize(WebKitWebExtension* extension, const void* userData) { + ASSERT(_comClient.IsValid() == true); // We have something to report back, do so... uint32_t result = _comClient->Open(RPC::CommunicationTimeOut); if (result != Core::ERROR_NONE) { @@ -160,7 +164,7 @@ static class PluginHost { } private: - static void windowObjectClearedCallback(WebKitScriptWorld* world, WebKitWebPage* page, WebKitFrame* frame) + static void windowObjectClearedCallback(WebKitScriptWorld* world, WebKitWebPage* page) { JavaScript::Milestone::InjectJS(world, frame); JavaScript::NotifyWPEFramework::InjectJS(world, frame); @@ -186,6 +190,7 @@ static class PluginHost { WebKitWebPage* page, PluginHost* host) { + ASSERT(host != nullptr); if (host->_logToSystemConsoleEnabled) { g_signal_connect(page, "console-message-sent", G_CALLBACK(consoleMessageSentCallback), host); @@ -202,6 +207,7 @@ static class PluginHost { } static void consoleMessageSentCallback(VARIABLE_IS_NOT_USED WebKitWebPage* page, WebKitConsoleMessage* message, PluginHost* host) { + ASSERT(host != nullptr); string messageString = Core::ToString(webkit_console_message_get_text(message)); uint64_t line = static_cast(webkit_console_message_get_line(message)); diff --git a/WebKitBrowser/InjectedBundle/WhiteListedOriginDomainsList.cpp b/WebKitBrowser/InjectedBundle/WhiteListedOriginDomainsList.cpp index 78550aedca..b5847408e1 100644 --- a/WebKitBrowser/InjectedBundle/WhiteListedOriginDomainsList.cpp +++ b/WebKitBrowser/InjectedBundle/WhiteListedOriginDomainsList.cpp @@ -107,6 +107,7 @@ namespace WebKit { string jsonString = WebKit::Utils::WKStringToString(returnedString); unique_ptr whiteList(new WhiteListedOriginDomainsList()); + ASSERT(whiteList != nullptr); ParseWhiteList(jsonString, whiteList->_whiteMap); WKRelease(returnData); diff --git a/WebKitBrowser/InjectedBundle/main.cpp b/WebKitBrowser/InjectedBundle/main.cpp index eb488aa98e..e8afc3d37e 100644 --- a/WebKitBrowser/InjectedBundle/main.cpp +++ b/WebKitBrowser/InjectedBundle/main.cpp @@ -91,7 +91,9 @@ static class PluginHost { : _engine(Core::ProxyType>::Create()) , _comClient(Core::ProxyType::Create(GetConnectionNode(), Core::ProxyType(_engine))) { +#ifndef USE_THUNDER_R4 _engine->Announcements(_comClient->Announcement()); +#endif } ~PluginHost() { @@ -106,6 +108,7 @@ static class PluginHost { void Initialize(WKBundleRef bundle, const void* userData = nullptr) #endif { + ASSERT(_comClient.IsValid() == true); // We have something to report back, do so... uint32_t result = _comClient->Open(RPC::CommunicationTimeOut); if (result != Core::ERROR_NONE) { @@ -138,6 +141,10 @@ static class PluginHost { if (_comClient.IsValid() == true) { _comClient.Release(); } + if (_engine.IsValid() == true) { + _engine.Release(); + } + Core::Singleton::Dispose(); } diff --git a/WebKitBrowser/WebKitBrowser.cpp b/WebKitBrowser/WebKitBrowser.cpp index ee33136332..6e1fb183cd 100644 --- a/WebKitBrowser/WebKitBrowser.cpp +++ b/WebKitBrowser/WebKitBrowser.cpp @@ -222,6 +222,7 @@ namespace Plugin { static_cast(_application)->Visible(visible); PluginHost::IStateControl::state currentState = stateControl->State(); Core::ProxyType> body(_jsonBodyDataFactory.Element()); + ASSERT(body != nullptr); string url; static_cast(_browser)->URL(url); body->URL = url; @@ -272,7 +273,11 @@ namespace Plugin { if (path.empty() == false) { string fullPath = _persistentStoragePath + path; Core::Directory dir(fullPath.c_str()); +#ifdef USE_THUNDER_R4 + if (!dir.Destroy()) { +#else if (!dir.Destroy(true)) { +#endif TRACE(Trace::Error, (_T("Failed to delete %s\n"), fullPath.c_str())); result = Core::ERROR_GENERAL; } @@ -283,6 +288,7 @@ namespace Plugin { void WebKitBrowser::LoadFinished(const string& URL, int32_t code) { + ASSERT(_service != nullptr); string message(string("{ \"url\": \"") + URL + string("\", \"loaded\":true, \"httpstatus\":") + Core::NumberType(code).Text() + string(" }")); TRACE(Trace::Information, (_T("LoadFinished: %s"), message.c_str())); _service->Notify(message); @@ -292,6 +298,7 @@ namespace Plugin { void WebKitBrowser::LoadFailed(const string& URL) { + ASSERT(_service != nullptr); string message(string("{ \"url\": \"") + URL + string("\" }")); TRACE(Trace::Information, (_T("LoadFailed: %s"), message.c_str())); _service->Notify(message); @@ -300,6 +307,7 @@ namespace Plugin { void WebKitBrowser::URLChange(const string& URL, bool loaded) { + ASSERT(_service != nullptr); string message(string("{ \"url\": \"") + URL + string("\", \"loaded\": ") + (loaded ? string("true") : string("false")) + string(" }")); TRACE(Trace::Information, (_T("URLChanged: %s"), message.c_str())); _service->Notify(message); @@ -308,6 +316,7 @@ namespace Plugin { void WebKitBrowser::VisibilityChange(const bool hidden) { + ASSERT(_service != nullptr); TRACE(Trace::Information, (_T("VisibilityChange: { \"hidden\": \"%s\"}"), (hidden ? "true" : "false"))); string message(string("{ \"hidden\": ") + (hidden ? _T("true") : _T("false")) + string("}")); _service->Notify(message); @@ -316,6 +325,7 @@ namespace Plugin { void WebKitBrowser::PageClosure() { + ASSERT(_service != nullptr); TRACE(Trace::Information, (_T("Closure: \"true\""))); _service->Notify(_T("{\"Closure\": true }")); Exchange::JWebBrowser::Event::PageClosure(*this); @@ -333,6 +343,7 @@ namespace Plugin { void WebKitBrowser::StateChange(const PluginHost::IStateControl::state state) { + ASSERT(_service != nullptr); TRACE(Trace::Information, (_T("StateChange: { \"State\": %d }"), state)); string message(string("{ \"suspended\": ") + (state == PluginHost::IStateControl::SUSPENDED ? _T("true") : _T("false")) + string(" }")); _service->Notify(message); @@ -341,6 +352,8 @@ namespace Plugin { void WebKitBrowser::Deactivated(RPC::IRemoteConnection* connection) { + ASSERT(_service != nullptr); + ASSERT(connection != nullptr); if (connection->Id() == _connectionId) { ASSERT(_service != nullptr); @@ -438,16 +451,23 @@ namespace WebKitBrowser { uint32_t result(0); if (_startTime != TimePoint::min()) { + + _adminLock.Lock(); + if (_children.Count() < RequiredChildren) { _children = Core::ProcessInfo::Iterator(_main.Id()); } + Core::ProcessInfo::Iterator children(_children); + + _adminLock.Unlock(); + result = _main.Resident(); - _children.Reset(); + children.Reset(); - while (_children.Next() == true) { - result += _children.Current().Resident(); + while (children.Next() == true) { + result += children.Current().Resident(); } } @@ -458,16 +478,23 @@ namespace WebKitBrowser { uint32_t result(0); if (_startTime != TimePoint::min()) { + + _adminLock.Lock(); + if (_children.Count() < RequiredChildren) { _children = Core::ProcessInfo::Iterator(_main.Id()); } + Core::ProcessInfo::Iterator children(_children); + + _adminLock.Unlock(); + result = _main.Allocated(); - _children.Reset(); + children.Reset(); - while (_children.Next() == true) { - result += _children.Current().Allocated(); + while (children.Next() == true) { + result += children.Current().Allocated(); } } @@ -478,16 +505,21 @@ namespace WebKitBrowser { uint32_t result(0); if (_startTime != TimePoint::min()) { + _adminLock.Lock(); if (_children.Count() < RequiredChildren) { _children = Core::ProcessInfo::Iterator(_main.Id()); } + Core::ProcessInfo::Iterator children(_children); + + _adminLock.Unlock(); + result = _main.Shared(); - _children.Reset(); + children.Reset(); - while (_children.Next() == true) { - result += _children.Current().Shared(); + while (children.Next() == true) { + result += children.Current().Shared(); } } @@ -498,9 +530,10 @@ namespace WebKitBrowser { // Refresh the children list !!! _adminLock.Lock(); _children = Core::ProcessInfo::Iterator(_main.Id()); + uint32_t nbrchildren = _children.Count(); _adminLock.Unlock(); - return ((_startTime == TimePoint::min()) || (_main.IsActive() == true) ? 1 : 0) + _children.Count(); + return ((_startTime == TimePoint::min()) || (_main.IsActive() == true) ? 1 : 0) + nbrchildren; } #ifdef USE_THUNDER_R4 bool IsOperational() const override @@ -521,17 +554,19 @@ namespace WebKitBrowser { // Refresh the children list !!! _children = Core::ProcessInfo::Iterator(_main.Id()); } + Core::ProcessInfo::Iterator children(_children); _adminLock.Unlock(); + //!< If there are less children than in the the mandatoryProcesses struct, we are done and return false. - if (_children.Count() >= RequiredChildren) { + if (children.Count() >= RequiredChildren) { - _children.Reset(); + children.Reset(); //!< loop over all child processes as long as we are operational. - while ((requiredProcesses != 0) && (true == _children.Next())) { + while ((requiredProcesses != 0) && (true == children.Next())) { uint8_t count(0); - string name(_children.Current().Name()); + string name(children.Current().Name()); while ((count < RequiredChildren) && (name != mandatoryProcesses[count])) { ++count; @@ -539,7 +574,7 @@ namespace WebKitBrowser { //& param); uint32_t get_headers(Core::JSON::ArrayType& response) const; uint32_t set_headers(const Core::JSON::ArrayType& param); - uint32_t get_cookiejar(JsonData::BrowserCookieJar::CookieJarParamsData& response) const; - uint32_t set_cookiejar(const JsonData::BrowserCookieJar::CookieJarParamsData& param); void event_bridgequery(const string& message); void event_statechange(const bool& suspended); // StateControl diff --git a/WebKitBrowser/WebKitBrowserJsonRpc.cpp b/WebKitBrowser/WebKitBrowserJsonRpc.cpp index f600ab3596..9cace46bf4 100644 --- a/WebKitBrowser/WebKitBrowserJsonRpc.cpp +++ b/WebKitBrowser/WebKitBrowserJsonRpc.cpp @@ -30,7 +30,6 @@ namespace Plugin { using namespace JsonData::Browser; using namespace JsonData::WebBrowser; using namespace JsonData::StateControl; - using namespace JsonData::BrowserCookieJar; using namespace WPEFramework::Exchange; // Registration @@ -41,7 +40,6 @@ namespace Plugin { Property>(_T("state"), &WebKitBrowser::get_state, &WebKitBrowser::set_state, this); /* StateControl */ Property>(_T("languages"), &WebKitBrowser::get_languages, &WebKitBrowser::set_languages, this); Property>(_T("headers"), &WebKitBrowser::get_headers, &WebKitBrowser::set_headers, this); - Property(_T("cookiejar"), &WebKitBrowser::get_cookiejar, &WebKitBrowser::set_cookiejar, this); Register(_T("delete"), &WebKitBrowser::endpoint_delete, this); } @@ -50,7 +48,6 @@ namespace Plugin { Unregister(_T("state")); Unregister(_T("headers")); Unregister(_T("languages")); - Unregister(_T("cookiejar")); Unregister(_T("delete")); } @@ -172,45 +169,6 @@ namespace Plugin { return result; } - // Property: cookiejar - // Return codes: - // - ERROR_NONE: Success - uint32_t WebKitBrowser::get_cookiejar(CookieJarParamsData& response) const - { - if (_cookieJar == nullptr) - return Core::ERROR_UNAVAILABLE; - - uint32_t version = 0; - uint32_t checksum = 0; - string payload; - - uint32_t result = - static_cast(_cookieJar)->CookieJar(version, checksum, payload); - - if (result == Core::ERROR_NONE) { - response.Version = version; - response.Checksum = checksum; - response.Payload = payload; - } - - return result; - } - - // Property: cookiejar - // Return codes: - // - ERROR_NONE: Success - uint32_t WebKitBrowser::set_cookiejar(const CookieJarParamsData& param) - { - if (_cookieJar == nullptr) - return Core::ERROR_UNAVAILABLE; - - uint32_t version = param.Version.Value(); - uint32_t checksum = param.Checksum.Value(); - const string& payload = param.Payload.Value(); - - return _cookieJar->CookieJar(version, checksum, payload); - } - // Event: statechange - Signals a state change of the service void WebKitBrowser::event_statechange(const bool& suspended) /* StateControl */ { diff --git a/WebKitBrowser/WebKitImplementation.cpp b/WebKitBrowser/WebKitImplementation.cpp index 0fa84f99b0..5335fcd51a 100644 --- a/WebKitBrowser/WebKitImplementation.cpp +++ b/WebKitBrowser/WebKitImplementation.cpp @@ -248,10 +248,7 @@ namespace Plugin { nullptr, // checkUserMediaPermissionForOrigin nullptr, // runBeforeUnloadConfirmPanel nullptr, // fullscreenMayReturnToInline - //willAddDetailedMessageToConsole, - [](WKPageRef, WKStringRef /* source */, WKStringRef, uint64_t line, uint64_t column, WKStringRef message, WKStringRef, const void* /* clientInfo */) { - TRACE_GLOBAL(BrowserConsoleLog, (message, line, column)); - }, + willAddDetailedMessageToConsole, nullptr, // requestPointerLock nullptr // didLosePointerLock }; @@ -374,9 +371,9 @@ static GSourceFuncs _handlerIntervention = public Exchange::IWebBrowser, public Exchange::IApplication, public Exchange::IBrowserScripting, - #if defined(ENABLE_CLOUD_COOKIE_JAR) +#if defined(ENABLE_CLOUD_COOKIE_JAR) public Exchange::IBrowserCookieJar, - #endif +#endif public PluginHost::IStateControl { public: class BundleConfig : public Core::JSON::Container { @@ -928,6 +925,11 @@ static GSourceFuncs _handlerIntervention = TRACE(Trace::Information, (_T("Bailed out before the end of the WPE main app was reached. %d"), 6000)); } + if (_service != nullptr) { + _service->Release(); + _service = nullptr; + } + implementation = nullptr; } @@ -952,6 +954,8 @@ static GSourceFuncs _handlerIntervention = [](gpointer customdata) -> gboolean { auto& data = *static_cast(customdata); WebKitImplementation* object = std::get<0>(data); + ASSERT(object != nullptr); + const string& headers = std::get<1>(data); object->_adminLock.Lock(); @@ -1006,6 +1010,7 @@ static GSourceFuncs _handlerIntervention = [](gpointer customdata) -> gboolean { auto& data = *static_cast(customdata); WebKitImplementation* object = std::get<0>(data); + ASSERT(object != nullptr); const string& useragent = std::get<1>(data); object->_adminLock.Lock(); @@ -1051,6 +1056,7 @@ static GSourceFuncs _handlerIntervention = [](gpointer customdata) -> gboolean { auto& data = *static_cast(customdata); WebKitImplementation* object = std::get<0>(data); + ASSERT(object != nullptr); bool enabled = std::get<1>(data); object->_adminLock.Lock(); @@ -1161,6 +1167,7 @@ static GSourceFuncs _handlerIntervention = [](gpointer customdata) -> gboolean { auto& data = *static_cast(customdata); WebKitImplementation* object = std::get<0>(data); + ASSERT(object != nullptr); #ifdef WEBKIT_GLIB_API WebKitCookieAcceptPolicy policy = std::get<1>(data); @@ -1218,6 +1225,7 @@ static GSourceFuncs _handlerIntervention = [](gpointer customdata) -> gboolean { BridgeMessageData& data = *static_cast(customdata); WebKitImplementation* object = std::get<0>(data); + ASSERT(object != nullptr); #ifdef WEBKIT_GLIB_API auto messageName = std::get<1>(data).c_str(); @@ -1250,6 +1258,7 @@ static GSourceFuncs _handlerIntervention = G_PRIORITY_DEFAULT, [](gpointer customdata) -> gboolean { WebKitImplementation* object = static_cast(customdata); + ASSERT(object != nullptr); #ifdef WEBKIT_GLIB_API WebKitWebContext* context = webkit_web_view_get_context(object->_view); webkit_web_context_garbage_collect_javascript_objects(context); @@ -1279,6 +1288,7 @@ static GSourceFuncs _handlerIntervention = [](gpointer customdata) -> gboolean { auto& data = *static_cast(customdata); WebKitImplementation* object = std::get<0>(data); + ASSERT(object != nullptr); auto& script = std::get<1>(data); #ifdef WEBKIT_GLIB_API webkit_web_view_run_javascript(object->_view, script.c_str(), nullptr, nullptr, nullptr); @@ -1308,6 +1318,7 @@ static GSourceFuncs _handlerIntervention = [](gpointer customdata) -> gboolean { auto& data = *static_cast(customdata); WebKitImplementation* object = std::get<0>(data); + ASSERT(object != nullptr); const auto& scriptContent = std::get<1>(data); const bool topFrameOnly = std::get<2>(data); object->AddUserScriptImpl(scriptContent.c_str(), topFrameOnly); @@ -1330,6 +1341,7 @@ static GSourceFuncs _handlerIntervention = G_PRIORITY_DEFAULT, [](gpointer customdata) -> gboolean { WebKitImplementation* object = static_cast(customdata); + ASSERT(object != nullptr); #ifdef WEBKIT_GLIB_API auto* userContentManager = webkit_web_view_get_user_content_manager(object->_view); webkit_user_content_manager_remove_all_scripts(userContentManager); @@ -1344,13 +1356,17 @@ static GSourceFuncs _handlerIntervention = } #if defined(ENABLE_CLOUD_COOKIE_JAR) - uint32_t CookieJar(uint32_t& version /* @out */, uint32_t& checksum /* @out */, string& payload /* @out */) const override + uint32_t CookieJar(Exchange::IBrowserCookieJar::Config& cookieJarData) const override { uint32_t result = Core::ERROR_GENERAL; if (_context == nullptr) return result; + uint32_t version; + uint32_t checksum; + string payload; + _adminLock.Lock(); if (_cookieJar.IsStale()) { _adminLock.Unlock(); @@ -1370,20 +1386,24 @@ static GSourceFuncs _handlerIntervention = _adminLock.Lock(); } + result = _cookieJar.Pack(version, checksum, payload); _adminLock.Unlock(); + cookieJarData.version = version; + cookieJarData.checksum = checksum; + cookieJarData.payload = payload; return result; } - uint32_t CookieJar(const uint32_t version, const uint32_t checksum, const string& payload) override + uint32_t CookieJar(const Exchange::IBrowserCookieJar::Config& cookieJarData) override { uint32_t result = Core::ERROR_GENERAL; - if (_context == nullptr) + if (_context == nullptr) { return result; - + } _adminLock.Lock(); - result = _cookieJar.Unpack(version, checksum, payload); + result = _cookieJar.Unpack(cookieJarData.version, cookieJarData.checksum, cookieJarData.payload); _adminLock.Unlock(); if (result == Core::ERROR_NONE) { g_main_context_invoke( @@ -1407,6 +1427,7 @@ static GSourceFuncs _handlerIntervention = void Register(Exchange::IBrowserCookieJar::INotification* sink) override { + ASSERT(sink != nullptr); _adminLock.Lock(); // Make sure a sink is not registered multiple times. @@ -1669,6 +1690,7 @@ static GSourceFuncs _handlerIntervention = [](gpointer customdata) -> gboolean { auto& data = *static_cast(customdata); WebKitImplementation* object = std::get<0>(data); + ASSERT(object != nullptr); string url = std::get<1>(data); object->_adminLock.Lock(); @@ -1752,6 +1774,7 @@ static GSourceFuncs _handlerIntervention = void Register(PluginHost::IStateControl::INotification* sink) { + ASSERT(sink != nullptr); _adminLock.Lock(); // Make sure a sink is not registered multiple times. @@ -1813,6 +1836,7 @@ static GSourceFuncs _handlerIntervention = void Register(Exchange::IWebBrowser::INotification* sink) override { + ASSERT(sink != nullptr); _adminLock.Lock(); // Make sure a sink is not registered multiple times. @@ -1846,6 +1870,7 @@ static GSourceFuncs _handlerIntervention = void Register(Exchange::IBrowser::INotification* sink) override { + ASSERT(sink != nullptr); _adminLock.Lock(); // Make sure a sink is not registered multiple times. @@ -1881,6 +1906,7 @@ static GSourceFuncs _handlerIntervention = void Register(Exchange::IApplication::INotification* sink) override { + ASSERT(sink != nullptr); _adminLock.Lock(); // Make sure a sink is not registered multiple times. @@ -1919,7 +1945,6 @@ static GSourceFuncs _handlerIntervention = uint32_t Identifier(string& id) const override { - PluginHost::ISubSystem* subSystem = _service->SubSystems(); if (subSystem) { const PluginHost::ISubSystem::IIdentifier* identifier(subSystem->Get()); @@ -2004,6 +2029,7 @@ static GSourceFuncs _handlerIntervention = [](gpointer customdata) -> gboolean { auto& data = *static_cast(customdata); WebKitImplementation* object = std::get<0>(data); + ASSERT(object != nullptr); Core::JSON::ArrayType array = std::get<1>(data); object->_adminLock.Lock(); @@ -2193,10 +2219,14 @@ static GSourceFuncs _handlerIntervention = uint32_t Configure(PluginHost::IShell* service) override { + ASSERT(service != nullptr); + #ifndef WEBKIT_GLIB_API _consoleLogPrefix = service->Callsign(); #endif + _service = service; + _service->AddRef(); _dataPath = service->DataPath(); @@ -2517,6 +2547,7 @@ static GSourceFuncs _handlerIntervention = _context, [](gpointer customdata) -> gboolean { WebKitImplementation* object = static_cast(customdata); + ASSERT(object != nullptr); #ifdef WEBKIT_GLIB_API webkit_web_view_hide(object->_view); #else @@ -2538,6 +2569,7 @@ static GSourceFuncs _handlerIntervention = _context, [](gpointer customdata) -> gboolean { WebKitImplementation* object = static_cast(customdata); + ASSERT(object != nullptr); #ifdef WEBKIT_GLIB_API webkit_web_view_show(object->_view); #else @@ -2562,6 +2594,7 @@ static GSourceFuncs _handlerIntervention = _context, [](gpointer customdata) -> gboolean { WebKitImplementation* object = static_cast(customdata); + ASSERT(object != nullptr); if (object->_config.LoadBlankPageOnSuspendEnabled.Value()) { const char kBlankURL[] = "about:blank"; if (object->_URL != kBlankURL) @@ -2595,6 +2628,7 @@ static GSourceFuncs _handlerIntervention = _context, [](gpointer customdata) -> gboolean { WebKitImplementation* object = static_cast(customdata); + ASSERT(object != nullptr); #ifdef WEBKIT_GLIB_API webkit_web_view_resume(object->_view); #else @@ -2612,6 +2646,7 @@ static GSourceFuncs _handlerIntervention = #ifdef WEBKIT_GLIB_API static void initializeWebExtensionsCallback(WebKitWebContext* context, WebKitImplementation* browser) { + ASSERT(browser != nullptr); webkit_web_context_set_web_extensions_directory(context, browser->_extensionPath.c_str()); // FIX it GVariant* data = g_variant_new("(smsb)", std::to_string(browser->_guid).c_str(), !browser->_config.Whitelist.Value().empty() ? browser->_config.Whitelist.Value().c_str() : nullptr, browser->_config.LogToSystemConsoleEnabled.Value()); @@ -2619,6 +2654,7 @@ static GSourceFuncs _handlerIntervention = } static void wpeNotifyWPEFrameworkMessageReceivedCallback(WebKitUserContentManager*, WebKitJavascriptResult* message, WebKitImplementation* browser) { + ASSERT(browser != nullptr); JSCValue* args = webkit_javascript_result_get_js_value(message); JSCValue* arrayLengthValue = jsc_value_object_get_property(args, "length"); int arrayLength = jsc_value_to_int32(arrayLengthValue); @@ -2637,6 +2673,7 @@ static GSourceFuncs _handlerIntervention = } static gboolean decidePolicyCallback(WebKitWebView*, WebKitPolicyDecision* decision, WebKitPolicyDecisionType type, WebKitImplementation* browser) { + ASSERT(browser != nullptr); if (type == WEBKIT_POLICY_DECISION_TYPE_RESPONSE) { auto *response = webkit_response_policy_decision_get_response(WEBKIT_RESPONSE_POLICY_DECISION(decision)); if (webkit_uri_response_is_main_frame(response)) { @@ -2648,10 +2685,12 @@ static GSourceFuncs _handlerIntervention = } static void uriChangedCallback(WebKitWebView* webView, GParamSpec*, WebKitImplementation* browser) { + ASSERT(browser != nullptr); browser->OnURLChanged(Core::ToString(webkit_web_view_get_uri(webView))); } static void loadChangedCallback(WebKitWebView* webView, WebKitLoadEvent loadEvent, WebKitImplementation* browser) { + ASSERT(browser != nullptr); if (loadEvent == WEBKIT_LOAD_FINISHED) { if (browser->_ignoreLoadFinishedOnce) { browser->_ignoreLoadFinishedOnce = false; @@ -2669,6 +2708,8 @@ static GSourceFuncs _handlerIntervention = } static void loadFailedCallback(WebKitWebView*, WebKitLoadEvent loadEvent, const gchar* failingURI, GError* error, WebKitImplementation* browser) { + ASSERT(browser != nullptr); + ASSERT(error != nullptr); string message(string("{ \"url\": \"") + failingURI + string("\", \"Error message\": \"") + error->message + string("\", \"loadEvent\":") + Core::NumberType(loadEvent).Text() + string(" }")); SYSLOG(Logging::Notification, (_T("LoadFailed: %s"), message.c_str())); if (g_error_matches(error, WEBKIT_NETWORK_ERROR, WEBKIT_NETWORK_ERROR_CANCELLED)) { @@ -2715,6 +2756,7 @@ static GSourceFuncs _handlerIntervention = } static void closeCallback(VARIABLE_IS_NOT_USED WebKitWebView* webView, WebKitImplementation* browser) { + ASSERT(browser != nullptr); browser->NotifyClosure(); } static gboolean decidePermissionCallback(VARIABLE_IS_NOT_USED WebKitWebView* webView, WebKitPermissionRequest* permissionRequest) @@ -2729,6 +2771,7 @@ static GSourceFuncs _handlerIntervention = } static WebKitWebView* createWebViewForAutomationCallback(VARIABLE_IS_NOT_USED WebKitAutomationSession* session, WebKitImplementation* browser) { + ASSERT(browser != nullptr); return browser->_view; } static void automationStartedCallback(VARIABLE_IS_NOT_USED WebKitWebContext* context, WebKitAutomationSession* session, WebKitImplementation* browser) @@ -2743,6 +2786,7 @@ static GSourceFuncs _handlerIntervention = } static gboolean userMessageReceivedCallback(WebKitWebView*, WebKitUserMessage* message, WebKitImplementation* browser) { + ASSERT(browser != nullptr); const char* name = webkit_user_message_get_name(message); if (g_strcmp0(name, Tags::BridgeObjectQuery) == 0) { GVariant* payload; @@ -2760,11 +2804,13 @@ static GSourceFuncs _handlerIntervention = } #if defined(ENABLE_CLOUD_COOKIE_JAR) static void cookieManagerChangedCallback(WebKitCookieManager* /* manager */, WebKitImplementation* browser) { + ASSERT(browser != nullptr); browser->NotifyCookieJarChanged(); } #endif uint32_t Worker() override { + ASSERT(_service != nullptr); _context = g_main_context_new(); _loop = g_main_loop_new(_context, FALSE); g_main_context_push_thread_default(_context); @@ -2993,6 +3039,7 @@ static GSourceFuncs _handlerIntervention = if (_config.FPS.Value() == true) { frameDisplayedCallbackID = webkit_web_view_add_frame_displayed_callback(_view, [](WebKitWebView*, gpointer userData) { auto* browser = static_cast(userData); + ASSERT(browser != nullptr); browser->SetFPS(); }, this, nullptr); } @@ -3196,6 +3243,7 @@ static GSourceFuncs _handlerIntervention = // cookiesDidChange [](WKCookieManagerRef, const void* clientInfo) { WebKitImplementation* browser = const_cast(static_cast(clientInfo)); + ASSERT(browser != nullptr); browser->NotifyCookieJarChanged(); } }; @@ -3374,8 +3422,11 @@ static GSourceFuncs _handlerIntervention = g_free(filtersPath); GBytes* data = g_bytes_new(_config.ContentFilter.Value().c_str(), _config.ContentFilter.Value().size()); + ASSERT(_service != nullptr); webkit_user_content_filter_store_save(store, _service->Callsign().c_str(), data, nullptr, [](GObject* obj, GAsyncResult* result, gpointer data) { WebKitImplementation* webkit_impl = static_cast(data); + ASSERT(webkit_impl != nullptr); + WebKitUserContentFilter* filter = webkit_user_content_filter_store_save_finish(WEBKIT_USER_CONTENT_FILTER_STORE(obj), result, nullptr); auto* userContentManager = webkit_web_view_get_user_content_manager(webkit_impl->_view); webkit_user_content_manager_add_filter(userContentManager, filter); @@ -3403,6 +3454,7 @@ static GSourceFuncs _handlerIntervention = [](GObject* object, GAsyncResult* result, gpointer user_data) { bool isWebProcessResponsive = webkit_web_view_is_web_process_responsive_finish(WEBKIT_WEB_VIEW(object), result, nullptr); WebKitImplementation* webkit_impl = static_cast(user_data); + ASSERT(webkit_impl != nullptr); webkit_impl->DidReceiveWebProcessResponsivenessReply(isWebProcessResponsive); }, this); @@ -3412,6 +3464,7 @@ static GSourceFuncs _handlerIntervention = this, [](bool isWebProcessResponsive, void* customdata) { WebKitImplementation* object = static_cast(customdata); + ASSERT(object != nullptr); object->DidReceiveWebProcessResponsivenessReply(isWebProcessResponsive); }); #endif @@ -3489,6 +3542,7 @@ static GSourceFuncs _handlerIntervention = #ifdef WEBKIT_GLIB_API static void isWebProcessResponsiveCallback(WebKitWebView*, GParamSpec*, WebKitImplementation* self) { + ASSERT(self != nullptr); if (webkit_web_view_get_is_web_process_responsive(self->_view) == true) { if (self->_unresponsiveReplyNum > 0) { @@ -3589,6 +3643,7 @@ static GSourceFuncs _handlerIntervention = { int configLen = strlen(Tags::Config); const WebKitImplementation* browser = static_cast(clientInfo); + ASSERT(browser != nullptr); string name = WKStringToString(messageName); @@ -3620,6 +3675,7 @@ static GSourceFuncs _handlerIntervention = /* static */ void didStartProvisionalNavigation(WKPageRef page, WKNavigationRef navigation, WKTypeRef /* userData */, const void* clientInfo) { WebKitImplementation* browser = const_cast(static_cast(clientInfo)); + ASSERT(browser != nullptr); WKURLRef urlRef = WKPageCopyActiveURL(page); WKStringRef urlStringRef = WKURLCopyString(urlRef); @@ -3637,6 +3693,7 @@ static GSourceFuncs _handlerIntervention = { if (type == kWKSameDocumentNavigationAnchorNavigation) { WebKitImplementation* browser = const_cast(static_cast(info)); + ASSERT(browser != nullptr); WKURLRef urlRef = WKPageCopyActiveURL(page); WKStringRef urlStringRef = WKURLCopyString(urlRef); @@ -3654,6 +3711,7 @@ static GSourceFuncs _handlerIntervention = { WebKitImplementation* browser = const_cast(static_cast(clientInfo)); + ASSERT(browser != nullptr); WKURLRef urlRef = WKPageCopyActiveURL(page); WKStringRef urlStringRef = WKURLCopyString(urlRef); @@ -3679,6 +3737,7 @@ static GSourceFuncs _handlerIntervention = /* static */ void onNotificationShow(WKPageRef /* page */, WKNotificationRef notification, const void* clientInfo) { const WebKitImplementation* browser = static_cast(clientInfo); + ASSERT(browser != nullptr); WKStringRef titleRef = WKNotificationCopyTitle(notification); WKStringRef bodyRef = WKNotificationCopyBody(notification); @@ -3699,18 +3758,21 @@ static GSourceFuncs _handlerIntervention = /* static */ void onFrameDisplayed(WKViewRef /* view */, const void* clientInfo) { WebKitImplementation* browser = const_cast(static_cast(clientInfo)); + ASSERT(browser != nullptr); browser->SetFPS(); } /* static */ void didRequestAutomationSession(WKContextRef context, WKStringRef sessionID, const void* clientInfo) { WebKitImplementation* browser = const_cast(static_cast(clientInfo)); + ASSERT(browser != nullptr); browser->OnRequestAutomationSession(context, sessionID); } /* static */ WKPageRef onAutomationSessionRequestNewPage(WKWebAutomationSessionRef, const void* clientInfo) { WebKitImplementation* browser = const_cast(static_cast(clientInfo)); + ASSERT(browser != nullptr); return browser->GetPage(); } @@ -3719,6 +3781,8 @@ static GSourceFuncs _handlerIntervention = WKFramePolicyListenerUse(listener); if (WKNavigationResponseIsMainFrame(response)) { WebKitImplementation* browser = const_cast(static_cast(clientInfo)); + ASSERT(browser != nullptr); + WKURLResponseRef urlResponse = WKNavigationResponseGetURLResponse(response); browser->SetResponseHTTPStatusCode(WKURLResponseHTTPStatusCode(urlResponse)); // WKRelease(urlResponse); @@ -3751,6 +3815,7 @@ static GSourceFuncs _handlerIntervention = } WebKitImplementation* browser = const_cast(static_cast(clientInfo)); + ASSERT(browser != nullptr); browser->OnLoadFailed(url); }