wxgtk_initialize_web_extensions() tries to find extensions in the
location where "make install" puts them. If that fails, either because
wx wasn't installed yet, or it was deployed (e.g. in static build)
without them, it looks into additional places - paths relative to CWD.
This is to faciliate running wx samples and tests, but by being enabled
in release builds too, it allowed loading unexpected executable code
from untrusted locations. For example, on typical desktops, one could
put malicious .so files into $HOME/lib to have them loaded by
wxWebView-using applications.
Address this by making the helper paths relative to the executable's
location, not working directory.
Don't log failure to load the extension during initialization, because
it isn't needed for many uses of wxWebView. Instead, only report the
failure at the time when functionality depending on it is used.
Also use g_warning() for logging consistently with other failures in
this file. This doesn't interrupt the user, yet shows the problem highly
visibly in the console.
wxWidgets already has a mechanism for locating plugins under
$libdir/wx/*, there's no reason to duplicate it with another
compile-time symbol.
As a consequence, this makes the library relocatable via WXPREFIX again.
The new method allows to set the zoom level more precisely than the
existing SetZoom(wxWebViewZoom).
Also improve the webview sample by using radio menu items instead of
check items and manually resetting them.
Closes https://github.com/wxWidgets/wxWidgets/pull/1894Closes#18769.
Define g_signal_handlers_disconnect_by_data() if it's not available,
i.e. when using glib older than 2.32 where it was added, to fix the
build under old systems such as CentOS 6 broken by the changes of
8278f7b618 (see #18084).
Also use it elsewhere instead of g_signal_handlers_disconnect_matched()
as it's more readable.
Closes https://github.com/wxWidgets/wxWidgets/pull/760
The custom scheme handling implementation had been inherited from the
original WebKit1 implementation. It attempted to intercept navigation
and resource load requests and then inject the resources. It seems that
this method doesn't work in WebKit2, but fortunately, there is native
support in WebKit2 for custom URI schemes through the
webkit_web_context_register_uri_scheme() API.
Also extend wxGtkError to allow creating it from an existing GError
object as a side-effect of these changes.
See https://github.com/wxWidgets/wxWidgets/pull/716
Check for web extension in ".." and "../.." to find it when running the
webview test and sample, respectively, even if "make install" hadn't
been done yet.
Also give a warning about the missing extension if we can't find it
anywhere.
This was somehow removed by af8f7f33c3 but
is needed: implicit conversion uses the current locale encoding, which
is often, but _not_ always, UTF-8, while we always need to use UTF-8
with WebKit functions.
Don't use wrong types and then cast the function pointer to the right
type, but just use the correct type from the beginning.
Also make the callback extern "C", as it should be, to be called from C
code.
Errors were reported in different ways (including not being reported at
all in wxMSW) in different ports. Try to consistently do it in the same
way now and use exactly the same sentences to facilitate translators
life.
This function was used only once and didn't really help understanding
the code and just required extra casts when passing arguments to it, for
some reason.
Just merge it into RunScriptSync() itself.
This helper function runs a JavaScript script and blocks until it
finishes executing, so try to use a name at least hinting at this
instead of being totally generic and useless.
Avoids issues with exceptions. Also remove worthless null pointer checks, the
pointer has already been dereferenced, and GetEventHandler() never returns NULL