Merge branch 'webkit-extension-fixes' of https://github.com/vslavik/wxWidgets

Improve WebKit2 extension loading: make the code cleaner and safer.

See https://github.com/wxWidgets/wxWidgets/pull/2075
This commit is contained in:
Vadim Zeitlin 2020-10-10 18:11:45 +02:00
commit 87fc7a9dc0
12 changed files with 98 additions and 86 deletions

View File

@ -949,8 +949,8 @@ MONODLL_CFLAGS = $(__monodll_PCH_INC) $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \
-I$(top_srcdir)/src/stc/scintilla/include \
-I$(top_srcdir)/src/stc/scintilla/lexlib \
-I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \
-DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL $(__webviewdll_ext_dir_define_p) \
$(PIC_FLAG) $(WX_CFLAGS) $(CPPFLAGS) $(CFLAGS)
-DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL $(PIC_FLAG) $(WX_CFLAGS) \
$(CPPFLAGS) $(CFLAGS)
MONODLL_CXXFLAGS = $(__monodll_PCH_INC) $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \
$(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \
$(__INC_EXPAT_p) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
@ -959,8 +959,8 @@ MONODLL_CXXFLAGS = $(__monodll_PCH_INC) $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \
-I$(top_srcdir)/src/stc/scintilla/include \
-I$(top_srcdir)/src/stc/scintilla/lexlib \
-I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \
-DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL $(__webviewdll_ext_dir_define_p) \
$(PIC_FLAG) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
-DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL $(PIC_FLAG) $(WX_CXXFLAGS) \
$(CPPFLAGS) $(CXXFLAGS)
MONODLL_OBJCXXFLAGS = $(__monodll_PCH_INC) $(__INC_TIFF_BUILD_p) \
$(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \
$(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \
@ -969,8 +969,8 @@ MONODLL_OBJCXXFLAGS = $(__monodll_PCH_INC) $(__INC_TIFF_BUILD_p) \
-I$(top_srcdir)/src/stc/scintilla/include \
-I$(top_srcdir)/src/stc/scintilla/lexlib \
-I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \
-DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL $(__webviewdll_ext_dir_define_p) \
$(PIC_FLAG) $(CPPFLAGS) $(OBJCXXFLAGS)
-DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL $(PIC_FLAG) $(CPPFLAGS) \
$(OBJCXXFLAGS)
MONODLL_OBJECTS = \
monodll_any.o \
monodll_appbase.o \
@ -1092,8 +1092,7 @@ MONOLIB_CFLAGS = $(__monolib_PCH_INC) $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \
-I$(top_srcdir)/src/stc/scintilla/include \
-I$(top_srcdir)/src/stc/scintilla/lexlib \
-I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \
-DLINK_LEXERS -DwxUSE_BASE=1 $(__webviewdll_ext_dir_define_p) $(WX_CFLAGS) \
$(CPPFLAGS) $(CFLAGS)
-DLINK_LEXERS -DwxUSE_BASE=1 $(WX_CFLAGS) $(CPPFLAGS) $(CFLAGS)
MONOLIB_CXXFLAGS = $(__monolib_PCH_INC) $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \
$(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \
$(__INC_EXPAT_p) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
@ -1102,8 +1101,7 @@ MONOLIB_CXXFLAGS = $(__monolib_PCH_INC) $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \
-I$(top_srcdir)/src/stc/scintilla/include \
-I$(top_srcdir)/src/stc/scintilla/lexlib \
-I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \
-DLINK_LEXERS -DwxUSE_BASE=1 $(__webviewdll_ext_dir_define_p) \
$(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
-DLINK_LEXERS -DwxUSE_BASE=1 $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
MONOLIB_OBJCXXFLAGS = $(__monolib_PCH_INC) $(__INC_TIFF_BUILD_p) \
$(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \
$(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \
@ -1112,8 +1110,7 @@ MONOLIB_OBJCXXFLAGS = $(__monolib_PCH_INC) $(__INC_TIFF_BUILD_p) \
-I$(top_srcdir)/src/stc/scintilla/include \
-I$(top_srcdir)/src/stc/scintilla/lexlib \
-I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \
-DLINK_LEXERS -DwxUSE_BASE=1 $(__webviewdll_ext_dir_define_p) $(CPPFLAGS) \
$(OBJCXXFLAGS)
-DLINK_LEXERS -DwxUSE_BASE=1 $(CPPFLAGS) $(OBJCXXFLAGS)
MONOLIB_OBJECTS = \
monolib_any.o \
monolib_appbase.o \
@ -1669,16 +1666,15 @@ WEBVIEWDLL_CXXFLAGS = $(__webviewdll_PCH_INC) $(__INC_TIFF_BUILD_p) \
$(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING -DWXUSINGDLL \
-DWXMAKINGDLL_WEBVIEW $(__webviewdll_ext_dir_define_p) \
$(__webview_additional_include_p) $(PIC_FLAG) $(WX_CXXFLAGS) $(CPPFLAGS) \
$(CXXFLAGS)
-DWXMAKINGDLL_WEBVIEW $(__webview_additional_include_p) $(PIC_FLAG) \
$(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
WEBVIEWDLL_OBJCXXFLAGS = $(__webviewdll_PCH_INC) $(__INC_TIFF_BUILD_p) \
$(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \
$(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING -DWXUSINGDLL \
-DWXMAKINGDLL_WEBVIEW $(__webviewdll_ext_dir_define_p) \
$(__webview_additional_include_p) $(PIC_FLAG) $(CPPFLAGS) $(OBJCXXFLAGS)
-DWXMAKINGDLL_WEBVIEW $(__webview_additional_include_p) $(PIC_FLAG) \
$(CPPFLAGS) $(OBJCXXFLAGS)
WEBVIEWDLL_OBJECTS = \
$(__WEBVIEW_SRC_PLATFORM_OBJECTS_2) \
webviewdll_webview.o \
@ -1691,15 +1687,13 @@ WEBVIEWLIB_CXXFLAGS = $(__webviewlib_PCH_INC) $(__INC_TIFF_BUILD_p) \
$(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING \
$(__webviewdll_ext_dir_define_p) $(__webview_additional_include_p) \
$(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
$(__webview_additional_include_p) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
WEBVIEWLIB_OBJCXXFLAGS = $(__webviewlib_PCH_INC) $(__INC_TIFF_BUILD_p) \
$(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \
$(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING \
$(__webviewdll_ext_dir_define_p) $(__webview_additional_include_p) \
$(CPPFLAGS) $(OBJCXXFLAGS)
$(__webview_additional_include_p) $(CPPFLAGS) $(OBJCXXFLAGS)
WEBVIEWLIB_OBJECTS = \
$(__WEBVIEW_SRC_PLATFORM_OBJECTS_3) \
webviewlib_webview.o \
@ -13341,9 +13335,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS = \
monodll_core_timer.o \
monodll_utilsexc_cf.o
@COND_PLATFORM_MACOSX_1@__OSX_LOWLEVEL_SRC_OBJECTS = $(COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS)
COND_USE_WEBVIEW_WEBKIT2_1___webviewdll_ext_dir_define_p_0 = --define \
WX_WEB_EXTENSIONS_DIRECTORY=\"$(PLUGINS_INST_DIR)/web-extensions\"
@COND_USE_WEBVIEW_WEBKIT2_1@__webviewdll_ext_dir_define_p_0 = $(COND_USE_WEBVIEW_WEBKIT2_1___webviewdll_ext_dir_define_p_0)
@COND_PLATFORM_MACOSX_1@__PLATFORM_SRC_OBJECTS_0 = monolib_unix_apptraits.o
@COND_PLATFORM_UNIX_1@__PLATFORM_SRC_OBJECTS_0 = monolib_unix_apptraits.o
COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_0 = \
@ -13758,9 +13749,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_4 = \
corelib_core_timer.o \
corelib_utilsexc_cf.o
@COND_PLATFORM_MACOSX_1@__OSX_LOWLEVEL_SRC_OBJECTS_1_4 = $(COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_4)
@COND_USE_WEBVIEW_WEBKIT2_1@__webviewdll_ext_dir_define_p \
@COND_USE_WEBVIEW_WEBKIT2_1@ = \
@COND_USE_WEBVIEW_WEBKIT2_1@ -DWX_WEB_EXTENSIONS_DIRECTORY=\"$(PLUGINS_INST_DIR)/web-extensions\"
@COND_TOOLKIT_MSW@__webview_additional_include_p = \
@COND_TOOLKIT_MSW@ -I$(top_srcdir)/3rdparty/webview2/build/native/include
@COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_HTML_1@__htmldll_library_link_DEP \
@ -20872,7 +20860,7 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/html/chm.cpp
monodll_version_rc.o: $(srcdir)/src/msw/version.rc $(MONODLL_ODEP)
$(WINDRES) -i$< -o$@ $(__INC_TIFF_BUILD_p_54) $(__INC_TIFF_p_54) $(__INC_JPEG_p_54) $(__INC_PNG_p_53) $(__INC_ZLIB_p_67) $(__INC_REGEX_p_65) $(__INC_EXPAT_p_65) --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_67) $(__DEBUG_DEFINE_p_66) $(__EXCEPTIONS_DEFINE_p_65) $(__RTTI_DEFINE_p_65) $(__THREAD_DEFINE_p_65) --define WXBUILDING --define WXDLLNAME=$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG) $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include --include-dir $(top_srcdir)/src/stc/scintilla/include --include-dir $(top_srcdir)/src/stc/scintilla/lexlib --include-dir $(top_srcdir)/src/stc/scintilla/src --define __WX__ --define SCI_LEXER --define NO_CXX11_REGEX --define LINK_LEXERS --define wxUSE_BASE=1 --define WXMAKINGDLL $(__webviewdll_ext_dir_define_p_0)
$(WINDRES) -i$< -o$@ $(__INC_TIFF_BUILD_p_54) $(__INC_TIFF_p_54) $(__INC_JPEG_p_54) $(__INC_PNG_p_53) $(__INC_ZLIB_p_67) $(__INC_REGEX_p_65) $(__INC_EXPAT_p_65) --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_67) $(__DEBUG_DEFINE_p_66) $(__EXCEPTIONS_DEFINE_p_65) $(__RTTI_DEFINE_p_65) $(__THREAD_DEFINE_p_65) --define WXBUILDING --define WXDLLNAME=$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG) $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include --include-dir $(top_srcdir)/src/stc/scintilla/include --include-dir $(top_srcdir)/src/stc/scintilla/lexlib --include-dir $(top_srcdir)/src/stc/scintilla/src --define __WX__ --define SCI_LEXER --define NO_CXX11_REGEX --define LINK_LEXERS --define wxUSE_BASE=1 --define WXMAKINGDLL
monolib_any.o: $(srcdir)/src/common/any.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/any.cpp
@ -36010,7 +35998,7 @@ webviewdll_webviewfshandler.o: $(srcdir)/src/common/webviewfshandler.cpp $(WEBVI
$(CXXC) -c -o $@ $(WEBVIEWDLL_CXXFLAGS) $(srcdir)/src/common/webviewfshandler.cpp
webviewdll_version_rc.o: $(srcdir)/src/msw/version.rc $(WEBVIEWDLL_ODEP)
$(WINDRES) -i$< -o$@ $(__INC_TIFF_BUILD_p_54) $(__INC_TIFF_p_54) $(__INC_JPEG_p_54) $(__INC_PNG_p_53) $(__INC_ZLIB_p_67) $(__INC_REGEX_p_65) $(__INC_EXPAT_p_65) --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_67) $(__DEBUG_DEFINE_p_66) $(__EXCEPTIONS_DEFINE_p_65) $(__RTTI_DEFINE_p_65) $(__THREAD_DEFINE_p_65) --define WXBUILDING --define WXDLLNAME=$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_webview$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG) $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include --define WXUSINGDLL --define WXMAKINGDLL_WEBVIEW $(__webviewdll_ext_dir_define_p_0) $(__webview_additional_include_p_1)
$(WINDRES) -i$< -o$@ $(__INC_TIFF_BUILD_p_54) $(__INC_TIFF_p_54) $(__INC_JPEG_p_54) $(__INC_PNG_p_53) $(__INC_ZLIB_p_67) $(__INC_REGEX_p_65) $(__INC_EXPAT_p_65) --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_67) $(__DEBUG_DEFINE_p_66) $(__EXCEPTIONS_DEFINE_p_65) $(__RTTI_DEFINE_p_65) $(__THREAD_DEFINE_p_65) --define WXBUILDING --define WXDLLNAME=$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_webview$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG) $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include --define WXUSINGDLL --define WXMAKINGDLL_WEBVIEW $(__webview_additional_include_p_1)
webviewlib_webview_ie.o: $(srcdir)/src/msw/webview_ie.cpp $(WEBVIEWLIB_ODEP)
$(CXXC) -c -o $@ $(WEBVIEWLIB_CXXFLAGS) $(srcdir)/src/msw/webview_ie.cpp

View File

@ -980,7 +980,7 @@ dnl ### begin block 20_COND_USE_THREADS_1[../../demos/bombs/bombs.bkl,../../demo
COND_USE_THREADS_1=""
fi
AC_SUBST(COND_USE_THREADS_1)
dnl ### begin block 20_COND_USE_WEBVIEW_WEBKIT2_1[../../demos/bombs/bombs.bkl,../../demos/forty/forty.bkl,../../demos/fractal/fractal.bkl,../../demos/life/life.bkl,../../demos/poem/poem.bkl,../../samples/access/access.bkl,../../samples/animate/anitest.bkl,../../samples/archive/archive.bkl,../../samples/artprov/artprov.bkl,../../samples/aui/auidemo.bkl,../../samples/calendar/calendar.bkl,../../samples/caret/caret.bkl,../../samples/clipboard/clipboard.bkl,../../samples/collpane/collpane.bkl,../../samples/combo/combo.bkl,../../samples/config/config.bkl,../../samples/console/console.bkl,../../samples/dataview/dataview.bkl,../../samples/debugrpt/debugrpt.bkl,../../samples/dialogs/dialogs.bkl,../../samples/dialup/dialup.bkl,../../samples/display/display.bkl,../../samples/dll/dll.bkl,../../samples/dnd/dnd.bkl,../../samples/docview/docview.bkl,../../samples/dragimag/dragimag.bkl,../../samples/drawing/drawing.bkl,../../samples/erase/erase.bkl,../../samples/event/event.bkl,../../samples/except/except.bkl,../../samples/exec/exec.bkl,../../samples/font/font.bkl,../../samples/fswatcher/fswatcher.bkl,../../samples/grid/grid.bkl,../../samples/help/help.bkl,../../samples/htlbox/htlbox.bkl,../../samples/html/about/about.bkl,../../samples/html/help/help.bkl,../../samples/html/helpview/helpview.bkl,../../samples/html/htmlctrl/htmlctrl.bkl,../../samples/html/printing/printing.bkl,../../samples/html/test/test.bkl,../../samples/html/virtual/virtual.bkl,../../samples/html/widget/widget.bkl,../../samples/html/zip/zip.bkl,../../samples/image/image.bkl,../../samples/internat/internat.bkl,../../samples/ipc/ipc.bkl,../../samples/joytest/joytest.bkl,../../samples/keyboard/keyboard.bkl,../../samples/layout/layout.bkl,../../samples/listctrl/listctrl.bkl,../../samples/mdi/mdi.bkl,../../samples/mediaplayer/mediaplayer.bkl,../../samples/memcheck/memcheck.bkl,../../samples/menu/menu.bkl,../../samples/minimal/minimal.bkl,../../samples/nativdlg/nativdlg.bkl,../../samples/notebook/notebook.bkl,../../samples/oleauto/oleauto.bkl,../../samples/opengl/cube/cube.bkl,../../samples/opengl/isosurf/isosurf.bkl,../../samples/opengl/penguin/penguin.bkl,../../samples/opengl/pyramid/pyramid.bkl,../../samples/ownerdrw/ownerdrw.bkl,../../samples/popup/popup.bkl,../../samples/power/power.bkl,../../samples/preferences/preferences.bkl,../../samples/printing/printing.bkl,../../samples/propgrid/propgrid.bkl,../../samples/regtest/regtest.bkl,../../samples/render/render.bkl,../../samples/ribbon/ribbon.bkl,../../samples/richtext/richtext.bkl,../../samples/sashtest/sashtest.bkl,../../samples/scroll/scroll.bkl,../../samples/secretstore/secretstore.bkl,../../samples/shaped/shaped.bkl,../../samples/sockets/sockets.bkl,../../samples/sound/sound.bkl,../../samples/splash/splash.bkl,../../samples/splitter/splitter.bkl,../../samples/statbar/statbar.bkl,../../samples/stc/stctest.bkl,../../samples/svg/svgtest.bkl,../../samples/taborder/taborder.bkl,../../samples/taskbar/taskbar.bkl,../../samples/taskbarbutton/taskbarbutton.bkl,../../samples/text/text.bkl,../../samples/thread/thread.bkl,../../samples/toolbar/toolbar.bkl,../../samples/treectrl/treectrl.bkl,../../samples/treelist/treelist.bkl,../../samples/typetest/typetest.bkl,../../samples/uiaction/uiaction.bkl,../../samples/validate/validate.bkl,../../samples/vscroll/vscroll.bkl,../../samples/webview/webview.bkl,../../samples/widgets/widgets.bkl,../../samples/wizard/wizard.bkl,../../samples/wrapsizer/wrapsizer.bkl,../../samples/xrc/xrcdemo.bkl,../../samples/xti/xti.bkl,../../tests/benchmarks/bench.bkl,../../tests/test.bkl,../../utils/emulator/src/emulator.bkl,../../utils/execmon/execmon.bkl,../../utils/helpview/src/helpview.bkl,../../utils/hhp2cached/hhp2cached.bkl,../../utils/ifacecheck/src/ifacecheck.bkl,../../utils/screenshotgen/src/screenshotgen.bkl,../../utils/wxrc/wxrc.bkl,wx.bkl] ###
dnl ### begin block 20_COND_USE_WEBVIEW_WEBKIT2_1[wx.bkl] ###
COND_USE_WEBVIEW_WEBKIT2_1="#"
if test "x$USE_WEBVIEW_WEBKIT2" = "x1" ; then
COND_USE_WEBVIEW_WEBKIT2_1=""

View File

@ -897,9 +897,4 @@ $(TAB)cl /EP /nologo "$(DOLLAR)(InputPath)" > "$(SETUPHDIR)\wx\msw\rcdefs.h"
<set var="VARS_DONT_ELIMINATE" append="1">top_srcdir</set>
<set var="webviewdll_ext_dir_define">
<if cond="FORMAT=='autoconf' and USE_WEBVIEW_WEBKIT2=='1'">WX_WEB_EXTENSIONS_DIRECTORY=\"$(PLUGINS_INST_DIR)/web-extensions\"</if>
</set>
</makefile>

View File

@ -28,7 +28,6 @@
<dll id="monodll" template="wx_dll,wx_monolib_or_dll"
cond="SHARED=='1' and MONOLITHIC=='1'">
<define>WXMAKINGDLL</define>
<define>$(webviewdll_ext_dir_define)</define>
<ldlibs>$(EXTRALIBS_XML)</ldlibs>
<ldlibs>$(EXTRALIBS_HTML)</ldlibs>
<ldlibs>$(EXTRALIBS_MEDIA)</ldlibs>
@ -40,7 +39,6 @@
<lib id="monolib" template="wx_lib,wx_monolib_or_dll"
cond="SHARED=='0' and MONOLITHIC=='1'">
<define>$(webviewdll_ext_dir_define)</define>
<if cond="FORMAT=='watcom'">
<set var="LIB_PAGESIZE" overwrite="1">8192</set>
</if>

View File

@ -184,7 +184,6 @@
cond="SHARED=='1' and USE_GUI=='1' and USE_WEBVIEW=='1' and MONOLITHIC=='0'">
<define>WXUSINGDLL</define>
<define>WXMAKINGDLL_WEBVIEW</define>
<define>$(webviewdll_ext_dir_define)</define>
<sources>$(WEBVIEW_SRC)</sources>
<library>coredll</library>
<library>basedll</library>
@ -195,7 +194,6 @@
<lib id="webviewlib" template="wx_lib"
cond="SHARED=='0' and USE_GUI=='1' and USE_WEBVIEW=='1' and MONOLITHIC=='0'">
<define>$(webviewdll_ext_dir_define)</define>
<sources>$(WEBVIEW_SRC)</sources>
<msvc-headers>$(WEBVIEW_HDR)</msvc-headers>
<include>$(webview_additional_include)</include>

View File

@ -26,10 +26,11 @@ endif()
wx_add_library(wxwebview ${WEBVIEW_FILES})
if(WXGTK AND wxUSE_WEBVIEW_WEBKIT2)
if(wxVERSION_IS_DEV)
set(WX_WEB_EXTENSIONS_DIRECTORY "lib/wx/${wxMAJOR_VERSION}.${wxMINOR_VERSION}.${wxRELEASE_NUMBER}/web-extensions")
else()
set(WX_WEB_EXTENSIONS_DIRECTORY "lib/wx/${wxMAJOR_VERSION}.${wxMINOR_VERSION}/web-extensions")
wx_lib_compile_definitions(wxwebview PRIVATE
-DWX_WEB_EXTENSIONS_DIRECTORY="${CMAKE_INSTALL_PREFIX}/${WX_WEB_EXTENSIONS_DIRECTORY}"
)
endif()
endif()
if(APPLE)

View File

@ -105,6 +105,8 @@ Changes in behaviour not resulting in compilation errors
- wxFileDialog::GetPath() and wxFileDialog::GetFilename() now assert and return
an empty string if called on dialogs with the wxFD_MULTIPLE style.
- wxGetInstallPrefix() now returns wxString.
Changes in behaviour which may result in build errors
-----------------------------------------------------

View File

@ -162,6 +162,7 @@ private:
#if wxUSE_WEBVIEW_WEBKIT2
bool CanExecuteEditingCommand(const gchar* command) const;
void SetupWebExtensionServer();
GDBusProxy *GetExtensionProxy() const;
bool RunScriptSync(const wxString& javascript, wxString* output = NULL);
#endif

View File

@ -162,7 +162,7 @@ WXDLLIMPEXP_BASE wxLinuxDistributionInfo wxGetLinuxDistributionInfo();
WXDLLIMPEXP_BASE wxString wxNow();
// Return path where wxWidgets is installed (mostly useful in Unices)
WXDLLIMPEXP_BASE const wxChar *wxGetInstallPrefix();
WXDLLIMPEXP_BASE wxString wxGetInstallPrefix();
// Return path to wxWin data (/usr/share/wx/%{version}) (Unices)
WXDLLIMPEXP_BASE wxString wxGetDataDir();

View File

@ -227,6 +227,8 @@ wxString wxDynamicLibrary::GetPluginsDirectory()
{
#ifdef __UNIX__
wxString format = wxGetInstallPrefix();
if ( format.empty() )
return wxEmptyString;
wxString dir;
format << wxFILE_SEP_PATH
<< wxT("lib") << wxFILE_SEP_PATH

View File

@ -182,12 +182,12 @@ void wxUsleep(unsigned long milliseconds)
}
#endif
const wxChar *wxGetInstallPrefix()
wxString wxGetInstallPrefix()
{
wxString prefix;
if ( wxGetEnv(wxT("WXPREFIX"), &prefix) )
return prefix.c_str();
return prefix;
#ifdef wxINSTALL_PREFIX
return wxT(wxINSTALL_PREFIX);

View File

@ -14,6 +14,7 @@
#include "wx/dir.h"
#include "wx/dynlib.h"
#include "wx/filename.h"
#include "wx/stdpaths.h"
#include "wx/stockitem.h"
#include "wx/gtk/webview_webkit.h"
#include "wx/gtk/control.h"
@ -369,7 +370,7 @@ wxgtk_webview_webkit_counted_matches(WebKitFindController *,
}
// This function checks if the specified directory contains our web extension.
static bool CheckDirectoryForWebExt(const char* dirname)
static bool CheckDirectoryForWebExt(const wxString& dirname)
{
wxDir dir;
if ( !wxDir::Exists(dirname) || !dir.Open(dirname) )
@ -399,6 +400,23 @@ static bool CheckDirectoryForWebExt(const char* dirname)
return false;
}
static bool TrySetWebExtensionsDirectory(WebKitWebContext *context, const wxString& dir)
{
if (dir.empty() || !CheckDirectoryForWebExt(dir))
return false;
webkit_web_context_set_web_extensions_directory(context, dir.utf8_str());
return true;
}
static wxString GetStandardWebExtensionsDir()
{
wxString dir = wxDynamicLibrary::GetPluginsDirectory();
if ( !dir.empty() )
dir += "/web-extensions";
return dir;
}
static void
wxgtk_initialize_web_extensions(WebKitWebContext *context,
GDBusServer *dbusServer)
@ -406,36 +424,28 @@ wxgtk_initialize_web_extensions(WebKitWebContext *context,
const char *address = g_dbus_server_get_client_address(dbusServer);
GVariant *user_data = g_variant_new("(s)", address);
// The first value is the location in which the extension is supposed to be
// normally installed, while the other three are used as fallbacks to allow
// running the tests and sample using wxWebView before installing it.
const char* const directories[] =
// Try to setup extension loading from the location it is supposed to be
// normally installed in.
if ( !TrySetWebExtensionsDirectory(context, GetStandardWebExtensionsDir()) )
{
WX_WEB_EXTENSIONS_DIRECTORY,
"..",
"../..",
"lib",
// These relative locations are used as fallbacks to allow running
// the tests and sample using wxWebView before installing it.
wxString exepath = wxFileName(wxStandardPaths::Get().GetExecutablePath()).GetPath();
if ( !exepath.empty() )
{
wxString const directories[] =
{
exepath + "/..",
exepath + "/../..",
exepath + "/lib",
};
const char* dir = NULL;
for ( size_t n = 0; n < WXSIZEOF(directories); ++n )
{
if ( CheckDirectoryForWebExt(directories[n]) )
{
dir = directories[n];
if ( !TrySetWebExtensionsDirectory(context, directories[n]) )
break;
}
}
if ( dir )
{
webkit_web_context_set_web_extensions_directory(context, dir);
}
else
{
wxLogWarning(_("Web extension not found in \"%s\", "
"some wxWebView functionality will be not available"),
WX_WEB_EXTENSIONS_DIRECTORY);
}
webkit_web_context_set_web_extensions_initialization_user_data(context,
@ -1020,10 +1030,11 @@ bool wxWebViewWebKit::IsEditable() const
void wxWebViewWebKit::DeleteSelection()
{
if (m_extension)
GDBusProxy *extension = GetExtensionProxy();
if (extension)
{
guint64 page_id = webkit_web_view_get_page_id(m_web_view);
GVariant *retval = g_dbus_proxy_call_sync(m_extension,
GVariant *retval = g_dbus_proxy_call_sync(extension,
"DeleteSelection",
g_variant_new("(t)", page_id),
G_DBUS_CALL_FLAGS_NONE, -1,
@ -1037,10 +1048,11 @@ void wxWebViewWebKit::DeleteSelection()
bool wxWebViewWebKit::HasSelection() const
{
if (m_extension)
GDBusProxy *extension = GetExtensionProxy();
if (extension)
{
guint64 page_id = webkit_web_view_get_page_id(m_web_view);
GVariant *retval = g_dbus_proxy_call_sync(m_extension,
GVariant *retval = g_dbus_proxy_call_sync(extension,
"HasSelection",
g_variant_new("(t)", page_id),
G_DBUS_CALL_FLAGS_NONE, -1,
@ -1064,10 +1076,11 @@ void wxWebViewWebKit::SelectAll()
wxString wxWebViewWebKit::GetSelectedText() const
{
if (m_extension)
GDBusProxy *extension = GetExtensionProxy();
if (extension)
{
guint64 page_id = webkit_web_view_get_page_id(m_web_view);
GVariant *retval = g_dbus_proxy_call_sync(m_extension,
GVariant *retval = g_dbus_proxy_call_sync(extension,
"GetSelectedText",
g_variant_new("(t)", page_id),
G_DBUS_CALL_FLAGS_NONE, -1,
@ -1085,10 +1098,11 @@ wxString wxWebViewWebKit::GetSelectedText() const
wxString wxWebViewWebKit::GetSelectedSource() const
{
if (m_extension)
GDBusProxy *extension = GetExtensionProxy();
if (extension)
{
guint64 page_id = webkit_web_view_get_page_id(m_web_view);
GVariant *retval = g_dbus_proxy_call_sync(m_extension,
GVariant *retval = g_dbus_proxy_call_sync(extension,
"GetSelectedSource",
g_variant_new("(t)", page_id),
G_DBUS_CALL_FLAGS_NONE, -1,
@ -1106,10 +1120,11 @@ wxString wxWebViewWebKit::GetSelectedSource() const
void wxWebViewWebKit::ClearSelection()
{
if (m_extension)
GDBusProxy *extension = GetExtensionProxy();
if (extension)
{
guint64 page_id = webkit_web_view_get_page_id(m_web_view);
GVariant *retval = g_dbus_proxy_call_sync(m_extension,
GVariant *retval = g_dbus_proxy_call_sync(extension,
"ClearSelection",
g_variant_new("(t)", page_id),
G_DBUS_CALL_FLAGS_NONE, -1,
@ -1123,10 +1138,11 @@ void wxWebViewWebKit::ClearSelection()
wxString wxWebViewWebKit::GetPageText() const
{
if (m_extension)
GDBusProxy *extension = GetExtensionProxy();
if (extension)
{
guint64 page_id = webkit_web_view_get_page_id(m_web_view);
GVariant *retval = g_dbus_proxy_call_sync(m_extension,
GVariant *retval = g_dbus_proxy_call_sync(extension,
"GetPageText",
g_variant_new("(t)", page_id),
G_DBUS_CALL_FLAGS_NONE, -1,
@ -1410,4 +1426,15 @@ void wxWebViewWebKit::SetupWebExtensionServer()
g_object_unref(observer);
}
GDBusProxy *wxWebViewWebKit::GetExtensionProxy() const
{
if (!m_extension)
{
g_warning("Web extension not found in \"%s\", "
"some wxWebView functionality will be not available",
(const char*)GetStandardWebExtensionsDir().utf8_str());
}
return m_extension;
}
#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT2