Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WebKitBrowser] Updating methods deprecated since 2.42 WebKit API #267

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions WebKitBrowser/Extension/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,17 @@ static class PluginHost {
G_CALLBACK(didStartProvisionalLoadForFrame), nullptr);
#endif
}

PUSH_WARNING(DISABLE_WARNING_DEPRECATED_USE)
static void consoleMessageSentCallback(VARIABLE_IS_NOT_USED WebKitWebPage* page, WebKitConsoleMessage* message, PluginHost* host)
{
string messageString = Core::ToString(webkit_console_message_get_text(message));
uint64_t line = static_cast<uint64_t>(webkit_console_message_get_line(message));

TRACE_GLOBAL(BrowserConsoleLog, (host->_consoleLogPrefix, messageString, line, 0));
}
POP_WARNING()

static gboolean userMessageReceivedCallback(WebKitWebPage* page, WebKitUserMessage* message)
{
const char* name = webkit_user_message_get_name(message);
Expand Down
7 changes: 7 additions & 0 deletions WebKitBrowser/WebKitImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,14 @@ static GSourceFuncs _handlerIntervention =
WebKitImplementation* object = std::get<0>(data);
auto& script = std::get<1>(data);
#ifdef WEBKIT_GLIB_API

#if WEBKIT_CHECK_VERSION(2, 42, 0)
// length: size of script, or -1 if script is a nul-terminated string
webkit_web_view_evaluate_javascript(object->_view, script.c_str(), -1, nullptr, nullptr, nullptr, nullptr, nullptr);
#else
webkit_web_view_run_javascript(object->_view, script.c_str(), nullptr, nullptr, nullptr);
#endif

#else
auto scriptRef = WKStringCreateWithUTF8CString(script.c_str());
WKPageRunJavaScriptInMainFrame(object->_page, scriptRef, nullptr, [](WKSerializedScriptValueRef, WKErrorRef, void*){});
Expand Down