diff --git a/WebKitBrowser/Extension/main.cpp b/WebKitBrowser/Extension/main.cpp index 0e17fd05..4be2a49c 100644 --- a/WebKitBrowser/Extension/main.cpp +++ b/WebKitBrowser/Extension/main.cpp @@ -193,6 +193,8 @@ 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)); @@ -200,6 +202,8 @@ static class PluginHost { 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); diff --git a/WebKitBrowser/WebKitImplementation.cpp b/WebKitBrowser/WebKitImplementation.cpp index 638676cd..9c52d1ab 100644 --- a/WebKitBrowser/WebKitImplementation.cpp +++ b/WebKitBrowser/WebKitImplementation.cpp @@ -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*){});