Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/Library.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/build.bat102
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c62
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.c3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java128
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java52
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common/version.txt2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties8
-rw-r--r--bundles/org.eclipse.swt/Readme.Win32.md14
-rw-r--r--bundles/org.eclipse.swt/buildSWT.xml4
-rw-r--r--bundles/org.eclipse.swt/pom.xml2
13 files changed, 326 insertions, 60 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/Library.java b/bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/Library.java
index bd2ceeac7b..263a20a9ff 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/Library.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/Library.java
@@ -28,7 +28,7 @@ public class Library {
/**
* SWT Minor version number (must be in the range 0..999)
*/
- static int MINOR_VERSION = 880;
+ static int MINOR_VERSION = 881;
/**
* SWT revision number (must be >= 0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/build.bat b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/build.bat
index 1aca05a59c..c71d94bf4e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/build.bat
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/build.bat
@@ -1,9 +1,12 @@
@rem ***************************************************************************
-@rem Copyright (c) 2000, 2018 IBM Corporation and others.
-@rem All rights reserved. This program and the accompanying materials
-@rem are made available under the terms of the Eclipse Public License v1.0
+@rem Copyright (c) 2000, 2021 IBM Corporation and others.
+@rem
+@rem This program and the accompanying materials
+@rem are made available under the terms of the Eclipse Public License 2.0
@rem which accompanies this distribution, and is available at
-@rem http://www.eclipse.org/legal/epl-v10.html
+@rem https://www.eclipse.org/legal/epl-2.0/
+@rem
+@rem SPDX-License-Identifier: EPL-2.0
@rem
@rem Contributors:
@rem IBM Corporation - initial API and implementation
@@ -16,70 +19,81 @@
echo
echo INFO Starting build of binaries. Detailed system setup instructions can be found in /Readme.Win32.md
-@rem builddir used for 32 bit building with webkit. Not needed on 64 bit builds.
+@rem SWT_BUILDDIR defaults to "W:" on the SWT Windows native build infrastructure machine.
IF "x.%SWT_BUILDDIR%"=="x." set "SWT_BUILDDIR=W:"
echo SWT build dir: %SWT_BUILDDIR%
-IF "x.%MSSDK%"=="x." set "MSSDK=%ProgramFiles(x86)%\Windows Kits\10"
-echo Microsoft Windows10 SDK dir: %MSSDK%
-IF "x.%WEBKIT_DIR%"=="x." set "WEBKIT_DIR=%SWT_BUILDDIR%\WebKit\r72896"
-echo Webkit dir: %WEBKIT_DIR%
-IF "x.%WEBKIT_SUPPORT_DIR%"=="x." set "WEBKIT_SUPPORT_DIR=%SWT_BUILDDIR%\WebKit\SupportLibrary"
-echo Webkit SupportLibrary dir: %WEBKIT_SUPPORT_DIR%
+@rem Specify VisualStudio Edition: 'Community', 'Enterprise', 'Professional' etc.
+IF "x.%MSVC_EDITION%"=="x." set "MSVC_EDITION=Community"
-IF "x.%MSVC_HOME%"=="x." set "MSVC_HOME=%SWT_BUILDDIR%\Microsoft\Visual Studio\2017\"
-IF NOT EXIST "%MSVC_HOME%" set "MSVC_HOME=%ProgramFiles(x86)%\Microsoft Visual Studio\2017"
+@rem Specify VisualStudio Version: '2017' or newer '2019'
+IF "x.%MSVC_VERSION%"=="x." set "MSVC_VERSION=2019"
+
+IF "x.%MSVC_HOME%"=="x." set "MSVC_HOME=%SWT_BUILDDIR%\Microsoft\Visual Studio\%MSVC_VERSION%\"
+IF NOT EXIST "%MSVC_HOME%" set "MSVC_HOME=%ProgramFiles(x86)%\Microsoft Visual Studio\%MSVC_VERSION%\BuildTools"
+IF NOT EXIST "%MSVC_HOME%" set "MSVC_HOME=%ProgramFiles(x86)%\Microsoft Visual Studio\%MSVC_VERSION%\%MSVC_EDITION%"
IF EXIST "%MSVC_HOME%" (
- echo "Microsoft Visual Studio 2017 dir: %MSVC_HOME%"
+ echo "Microsoft Visual Studio %MSVC_VERSION% dir: %MSVC_HOME%"
) ELSE (
- echo "WARNING: Microsoft Visual Studio 2017 was not found."
+ echo "WARNING: Microsoft Visual Studio %MSVC_VERSION% was not found."
+ echo " Refer steps for SWT Windows native setup: https://www.eclipse.org/swt/swt_win_native.php"
)
-IF "x.%1"=="x.x86" GOTO X86
-IF "x.%1"=="x.x86_64" GOTO X86_64
-
-:X86
-IF "x.%OUTPUT_DIR%"=="x." set OUTPUT_DIR=..\..\..\org.eclipse.swt.win32.win32.x86
-IF "x.%SWT_JAVA_HOME%"=="x." set "SWT_JAVA_HOME=%SWT_BUILDDIR%\Java\Oracle\jdk1.8.0-latest\x86"
-IF "x.%SWT_JAVA_HOME%"=="x." (
- echo "WARNING: x86 Java JDK not found. Please set SWT_JAVA_HOME to your JDK directory."
-) ELSE (
- echo "SWT_JAVA_HOME x86: %SWT_JAVA_HOME%"
+IF NOT "x.%1"=="x.x86_64" (
+ ECHO 32-bit builds are no longer supported.
+ EXIT /B 1
)
-call "%MSVC_HOME%\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
-IF x.%1==x.x86 shift
-GOTO MAKE
-:X86_64
set PROCESSOR_ARCHITECTURE=AMD64
IF "x.%OUTPUT_DIR%"=="x." set OUTPUT_DIR=..\..\..\org.eclipse.swt.win32.win32.x86_64
-IF "x.%SWT_JAVA_HOME%"=="x." (
- IF exist "%SWT_BUILDDIR%\Java\Oracle\jdk1.8.0-latest\x64" (
- set "SWT_JAVA_HOME=%SWT_BUILDDIR%\Java\Oracle\jdk1.8.0-latest\x64"
- ) ELSE (
- IF exist "C:\Program Files\Java\jdk*" (
- echo "Found Java in C:\Program Files\Java\jdk, automatically setting SWT_JAVA_HOME to latest java"
- for /d %%i in ("\Program Files\Java\jdk*") do set SWT_JAVA_HOME=%%i
- )
- )
-)
-IF "x.%SWT_JAVA_HOME%"=="x." (
+:: Search for a usable JDK
+:: -----------------------
+IF "%SWT_JAVA_HOME%"=="" ECHO 'SWT_JAVA_HOME' was not provided, auto-searching for JDK...
+:: Bug 572733: JDK path used on Azure build machines
+IF "%SWT_JAVA_HOME%"=="" CALL :TryToUseJdk "%ProgramFiles%\AdoptOpenJDK\jdk-8.0.292.10-hotspot"
+:: Bug 526802: Probably some kind of legacy build machine path
+IF "%SWT_JAVA_HOME%"=="" CALL :TryToUseJdk "%SWT_BUILDDIR%\Java\Oracle\jdk1.8.0-latest\x64"
+:: Search for generic JDKs so that user can build with little configuration
+:: Note that first found JDK wins, so sort them by order of preference.
+IF "%SWT_JAVA_HOME%"=="" CALL :TryToUseJdk "%ProgramFiles%\Java\jdk*"
+IF "%SWT_JAVA_HOME%"=="" CALL :TryToUseJdk "%ProgramFiles%\AdoptOpenJDK\jdk*"
+IF NOT EXIST "%SWT_JAVA_HOME%" (
echo "WARNING: x64 Java JDK not found. Please set SWT_JAVA_HOME to your JDK directory."
+ echo " Refer steps for SWT Windows native setup: https://www.eclipse.org/swt/swt_win_native.php"
) ELSE (
echo "SWT_JAVA_HOME x64: %SWT_JAVA_HOME%"
)
set CFLAGS=-DJNI64
-call "%MSVC_HOME%\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
+call "%MSVC_HOME%\VC\Auxiliary\Build\vcvarsall.bat" x64
shift
-GOTO MAKE
-:MAKE
@rem if call to vcvarsall.bat (which sets up environment) silently fails, then provide advice to user.
WHERE cl
if %ERRORLEVEL% NEQ 0 (
echo "WARNING: cl (Microsoft C compiler) not found on path. Please install Microsoft Visual Studio."
echo " If already installed, try launching eclipse from the 'Developer Command Prompt for VS' "
+ echo " Refer steps for SWT Windows native setup: https://www.eclipse.org/swt/swt_win_native.php"
+)
+nmake -f make_win32.mak %1 %2 %3 %4 %5 %6 %7 %8 %9
+GOTO :EOF
+
+:TryToUseJdk
+SET TESTED_JDK_PATH_MASK=%~1
+:: Loop over all directories matching mask.
+:: Note that directories are iterated in alphabetical order and *last* hit will
+:: be selected in hopes to select the highest available JDK version.
+FOR /D %%I IN ("%TESTED_JDK_PATH_MASK%") DO (
+ IF NOT EXIST "%%~I" (
+ ECHO -- JDK '%%~I' doesn't exist on disk
+ GOTO :EOF
+ )
+ IF NOT EXIST "%%~I\include\jni.h" (
+ ECHO -- JDK '%%~I' is bad: no jni.h
+ GOTO :EOF
+ )
+ ECHO -- JDK '%%~I' looks good, selecting it
+ SET SWT_JAVA_HOME=%%~I
)
-nmake -f make_win32.mak %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file
+GOTO :EOF
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c
index c98e232ff4..8cd55c11e7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk.c
@@ -2296,6 +2296,30 @@ JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1uri_1response_1get_1mime_1
}
#endif
+#ifndef NO__1webkit_1web_1context_1allow_1tls_1certificate_1for_1host
+JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1context_1allow_1tls_1certificate_1for_1host)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jbyteArray arg2)
+{
+ jbyte *lparg2=NULL;
+ jintLong rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1context_1allow_1tls_1certificate_1for_1host_FUNC);
+ if (arg2) if ((lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL)) == NULL) goto fail;
+/*
+ rc = (jintLong)webkit_web_context_allow_tls_certificate_for_host(arg0, arg1, lparg2);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_web_context_allow_tls_certificate_for_host)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong, jintLong, jbyte *))fp)(arg0, arg1, lparg2);
+ }
+ }
+fail:
+ if (arg2 && lparg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0);
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1context_1allow_1tls_1certificate_1for_1host_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1webkit_1web_1context_1get_1default
JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1context_1get_1default)
(JNIEnv *env, jclass that)
@@ -2376,6 +2400,24 @@ JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1context_1set_1favicon
}
#endif
+#ifndef NO__1webkit_1web_1context_1set_1tls_1errors_1policy
+JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1context_1set_1tls_1errors_1policy)
+ (JNIEnv *env, jclass that, jintLong arg0, jint arg1)
+{
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1context_1set_1tls_1errors_1policy_FUNC);
+/*
+ webkit_web_context_set_tls_errors_policy(arg0, arg1);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_web_context_set_tls_errors_policy)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jint))fp)(arg0, arg1);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1context_1set_1tls_1errors_1policy_FUNC);
+}
+#endif
+
#ifndef NO__1webkit_1web_1context_1set_1web_1extensions_1directory
JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1context_1set_1web_1extensions_1directory)
(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1)
@@ -2779,6 +2821,26 @@ fail:
}
#endif
+#ifndef NO__1webkit_1web_1view_1get_1context
+JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1get_1context)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1get_1context_FUNC);
+/*
+ rc = (jintLong)webkit_web_view_get_context(arg0);
+*/
+ {
+ WebKitGTK_LOAD_FUNCTION(fp, webkit_web_view_get_context)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1get_1context_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1webkit_1web_1view_1get_1dom_1document
JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1get_1dom_1document)
(JNIEnv *env, jclass that, jintLong arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.c b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.c
index dda54e9370..f6afdf4920 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.c
@@ -136,10 +136,12 @@ char * WebKitGTK_nativeFunctionNames[] = {
"_1webkit_1uri_1request_1new",
"_1webkit_1uri_1response_1get_1content_1length",
"_1webkit_1uri_1response_1get_1mime_1type",
+ "_1webkit_1web_1context_1allow_1tls_1certificate_1for_1host",
"_1webkit_1web_1context_1get_1default",
"_1webkit_1web_1context_1get_1type",
"_1webkit_1web_1context_1get_1website_1data_1manager",
"_1webkit_1web_1context_1set_1favicon_1database_1directory",
+ "_1webkit_1web_1context_1set_1tls_1errors_1policy",
"_1webkit_1web_1context_1set_1web_1extensions_1directory",
"_1webkit_1web_1context_1set_1web_1extensions_1initialization_1user_1data",
"_1webkit_1web_1data_1source_1get_1data",
@@ -160,6 +162,7 @@ char * WebKitGTK_nativeFunctionNames[] = {
"_1webkit_1web_1view_1can_1go_1forward",
"_1webkit_1web_1view_1can_1show_1mime_1type",
"_1webkit_1web_1view_1execute_1script",
+ "_1webkit_1web_1view_1get_1context",
"_1webkit_1web_1view_1get_1dom_1document",
"_1webkit_1web_1view_1get_1estimated_1load_1progress",
"_1webkit_1web_1view_1get_1load_1status",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h
index 84c9ba1201..39bf726604 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/library/webkitgtk_stats.h
@@ -146,10 +146,12 @@ typedef enum {
_1webkit_1uri_1request_1new_FUNC,
_1webkit_1uri_1response_1get_1content_1length_FUNC,
_1webkit_1uri_1response_1get_1mime_1type_FUNC,
+ _1webkit_1web_1context_1allow_1tls_1certificate_1for_1host_FUNC,
_1webkit_1web_1context_1get_1default_FUNC,
_1webkit_1web_1context_1get_1type_FUNC,
_1webkit_1web_1context_1get_1website_1data_1manager_FUNC,
_1webkit_1web_1context_1set_1favicon_1database_1directory_FUNC,
+ _1webkit_1web_1context_1set_1tls_1errors_1policy_FUNC,
_1webkit_1web_1context_1set_1web_1extensions_1directory_FUNC,
_1webkit_1web_1context_1set_1web_1extensions_1initialization_1user_1data_FUNC,
_1webkit_1web_1data_1source_1get_1data_FUNC,
@@ -170,6 +172,7 @@ typedef enum {
_1webkit_1web_1view_1can_1go_1forward_FUNC,
_1webkit_1web_1view_1can_1show_1mime_1type_FUNC,
_1webkit_1web_1view_1execute_1script_FUNC,
+ _1webkit_1web_1view_1get_1context_FUNC,
_1webkit_1web_1view_1get_1dom_1document_FUNC,
_1webkit_1web_1view_1get_1estimated_1load_1progress_FUNC,
_1webkit_1web_1view_1get_1load_1status_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
index f987f90f65..c89911d861 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
@@ -140,6 +140,11 @@ class WebKit extends WebBrowser {
BrowserFunction eventFunction; //Webkit1 only.
boolean ignoreDispose; // Webkit1 & Webkit2.
+ boolean tlsError;
+ long /*int*/ tlsErrorCertificate;
+ String tlsErrorUriString;
+ URI tlsErrorUri;
+ String tlsErrorType;
/**
* Timeout used for javascript execution / deadlock detection.
@@ -235,6 +240,7 @@ class WebKit extends WebBrowser {
static final int FINISHED = 23; // webkit2 only.
static final int DOWNLOAD_STARTED = 24; // Webkit2 (webkit1 equivalent is DOWNLOAD_REQUESTED)
static final int WIDGET_EVENT = 25; // Webkit2. Used for events like keyboard/mouse input. See Bug 528549 and Bug 533833.
+ static final int LOAD_FAILED_TLS = 26; // Webkit2 only
static final String KEY_CHECK_SUBWINDOW = "org.eclipse.swt.internal.control.checksubwindow"; //$NON-NLS-1$
@@ -261,6 +267,9 @@ class WebKit extends WebBrowser {
/** Webkit1 & Webkit2, Process key/mouse events from javascript. */
static Callback JSDOMEventProc;
+ /** Flag indicating whether TLS errors (like self-signed certificates) are to be ignored. Webkit2 only.*/
+ static final boolean ignoreTls;
+
static {
WebViewType = WebKitGTK.webkit_web_view_get_type ();
Proc2 = new Callback (WebKit.class, "Proc", 2); //$NON-NLS-1$
@@ -404,6 +413,7 @@ class WebKit extends WebBrowser {
SetPendingCookies (NativePendingCookies);
NativePendingCookies = null;
}
+ ignoreTls = WEBKIT2 && "true".equals(System.getProperty("org.eclipse.swt.internal.webkitgtk.ignoretlserrors"));
}
@Override
@@ -1014,6 +1024,7 @@ long /*int*/ webViewProc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ a
case CONSOLE_MESSAGE: return webkit_console_message (handle, arg0, arg1, arg2);
case WINDOW_OBJECT_CLEARED: return webkit_window_object_cleared (handle, arg0, arg1, arg2);
case CONTEXT_MENU: return webkit_context_menu(handle, arg0, arg1, arg2);
+ case LOAD_FAILED_TLS: return webkit_load_failed_tls(handle, arg0, arg1, arg2);
default: return 0;
}
}
@@ -1088,6 +1099,12 @@ public void create (Composite parent, int style) {
bug522733FirstInstanceCreated = true;
OS.g_object_ref(webView);
}
+ if (ignoreTls) {
+ WebKitGTK.webkit_web_context_set_tls_errors_policy(WebKitGTK.webkit_web_view_get_context(webView),
+ WebKitGTK.WEBKIT_TLS_ERRORS_POLICY_IGNORE);
+ System.out.println("***WARNING: WebKitGTK is configured to ignore TLS errors via -Dorg.eclipse.swt.internal.webkitgtk.ignoretlserrors=true .");
+ System.out.println("***WARNING: Please use for development purposes only!");
+ }
if (WEBKIT1) {
webViewData = C.malloc (C.PTR_SIZEOF);
@@ -1122,6 +1139,7 @@ public void create (Composite parent, int style) {
OS.g_signal_connect (webView, WebKitGTK.mouse_target_changed, Proc4.getAddress (), MOUSE_TARGET_CHANGED);
OS.g_signal_connect (webView, WebKitGTK.context_menu, Proc5.getAddress (), CONTEXT_MENU);
+ OS.g_signal_connect (webView, WebKitGTK.load_failed_with_tls_errors, Proc5.getAddress (), LOAD_FAILED_TLS);
}
@@ -3268,7 +3286,6 @@ long /*int*/ webkit_load_changed (long /*int*/ web_view, int status, long user_d
return handleLoadCommitted (uri, true);
}
case WebKitGTK.WEBKIT2_LOAD_FINISHED: {
-
registerBrowserFunctions(); // Bug 508217
addEventHandlers (web_view, true);
@@ -3277,16 +3294,123 @@ long /*int*/ webkit_load_changed (long /*int*/ web_view, int status, long user_d
long /*int*/ uri = WebKitGTK.webkit_web_view_get_uri (webView);
fireNewTitleEvent(getString(uri));
}
-
fireProgressCompletedEvent();
+ /*
+ * If there is a pending TLS error, handle it by prompting the user for input.
+ * This is done by popping up a message box and asking if the user would like
+ * ignore warnings for this host. Clicking yes will do so, clicking no will
+ * load the previous page.
+ *
+ * Not applicable if the ignoreTls flag has been set. See bug 531341.
+ */
+ if (tlsError && !ignoreTls) {
+ tlsError = false;
+ String javaHost = tlsErrorUri.getHost();
+ MessageBox prompt = new MessageBox (browser.getShell(), SWT.YES | SWT.NO);
+ prompt.setText(SWT.getMessage("SWT_InvalidCert_Title"));
+ String specific = tlsErrorType.isEmpty() ? "\n\n" : "\n\n" + tlsErrorType + "\n\n";
+ String message = SWT.getMessage("SWT_InvalidCert_Message", new Object[] {javaHost}) +
+ specific + SWT.getMessage("SWT_InvalidCert_Connect");
+ prompt.setMessage(message);
+ int result = prompt.open();
+ if (result == SWT.YES) {
+ long /*int*/ webkitcontext = WebKitGTK.webkit_web_view_get_context(web_view);
+ if (javaHost != null) {
+ byte [] host = Converter.javaStringToCString(javaHost);
+ WebKitGTK.webkit_web_context_allow_tls_certificate_for_host(webkitcontext, tlsErrorCertificate, host);
+ WebKitGTK.webkit_web_view_reload (web_view);
+ } else {
+ System.err.println("***ERROR: Unable to parse host from URI!");
+ }
+ } else {
+ back();
+ }
+ // De-reference Webkit certificate so it can be freed
+ if (tlsErrorCertificate != 0) {
+ OS.g_object_unref (tlsErrorCertificate);
+ tlsErrorCertificate = 0;
+ }
+ }
+
return 0;
}
}
return 0;
}
+/**
+ * This method is only called by Webkit2.
+ *
+ * Called in cases where a web page failed to load due to TLS errors
+ * (self-signed certificates, as an example).
+ */
+long /*int*/ webkit_load_failed_tls (long /*int*/ web_view, long /*int*/ failing_uri, long /*int*/ certificate, long /*int*/ error) {
+ assert WEBKIT2 : WebKitGTK.Webkit2AssertMsg;
+ if (!ignoreTls) {
+ // Set tlsError flag so that the user can be prompted once this "bad" page has finished loading
+ tlsError = true;
+ OS.g_object_ref(certificate);
+ tlsErrorCertificate = certificate;
+ convertUri (failing_uri);
+ switch ((int)/*64*/error) {
+ case WebKitGTK.G_TLS_CERTIFICATE_UNKNOWN_CA: {
+ tlsErrorType = SWT.getMessage("SWT_InvalidCert_UnknownCA");
+ break;
+ }
+ case WebKitGTK.G_TLS_CERTIFICATE_BAD_IDENTITY: {
+ tlsErrorType = SWT.getMessage("SWT_InvalidCert_BadIdentity");
+ break;
+ }
+ case WebKitGTK.G_TLS_CERTIFICATE_NOT_ACTIVATED: {
+ tlsErrorType = SWT.getMessage("SWT_InvalidCert_NotActivated");
+ break;
+ }
+ case WebKitGTK.G_TLS_CERTIFICATE_EXPIRED: {
+ tlsErrorType = SWT.getMessage("SWT_InvalidCert_Expired");
+ break;
+ }
+ case WebKitGTK.G_TLS_CERTIFICATE_REVOKED: {
+ tlsErrorType = SWT.getMessage("SWT_InvalidCert_Revoked");
+ break;
+ }
+ case WebKitGTK.G_TLS_CERTIFICATE_INSECURE: {
+ tlsErrorType = SWT.getMessage("SWT_InvalidCert_Insecure");
+ break;
+ }
+ case WebKitGTK.G_TLS_CERTIFICATE_GENERIC_ERROR: {
+ tlsErrorType = SWT.getMessage("SWT_InvalidCert_GenericError");
+ break;
+ }
+ case WebKitGTK.G_TLS_CERTIFICATE_VALIDATE_ALL: {
+ tlsErrorType = SWT.getMessage("SWT_InvalidCert_ValidateAll");
+ break;
+ }
+ default: {
+ tlsErrorType = SWT.getMessage("SWT_InvalidCert_GenericError");
+ break;
+ }
+ }
+ }
+ return 0;
+}
+/**
+ * Converts a WebKit URI into a Java URI object.
+ *
+ * @param webkitUri a long pointing to the URI in C string form (gchar *)
+ * @throws URISyntaxException if the string violates RFC 2396, or is otherwise
+ * malformed
+ */
+void convertUri (long /*int*/ webkitUri) {
+ try {
+ tlsErrorUriString = Converter.cCharPtrToJavaString(webkitUri, false);
+ tlsErrorUri = new URI (tlsErrorUriString);
+ } catch (URISyntaxException e) {
+ System.err.println("***ERROR: Malformed URI from WebKit!");
+ return;
+ }
+}
/**
* Triggered by a change in property. (both gdouble[0,1])
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java
index 6e1486ea68..98144e1fcb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java
@@ -94,6 +94,17 @@ public class WebKitGTK extends C {
public static final int WEBKIT_CREDENTIAL_PERSISTENCE_FOR_SESSION = 1;
public static final int WEBKIT_CREDENTIAL_PERSISTENCE_PERMANENT = 2;
+ public static final int WEBKIT_TLS_ERRORS_POLICY_IGNORE = 0;
+
+ public static final int G_TLS_CERTIFICATE_UNKNOWN_CA = 0;
+ public static final int G_TLS_CERTIFICATE_BAD_IDENTITY = 1;
+ public static final int G_TLS_CERTIFICATE_NOT_ACTIVATED = 2;
+ public static final int G_TLS_CERTIFICATE_EXPIRED = 3;
+ public static final int G_TLS_CERTIFICATE_REVOKED = 4;
+ public static final int G_TLS_CERTIFICATE_INSECURE = 5;
+ public static final int G_TLS_CERTIFICATE_GENERIC_ERROR = 6;
+ public static final int G_TLS_CERTIFICATE_VALIDATE_ALL = 7;
+
public static final int WEBKIT_WEBSITE_DATA_COOKIES = 1 << 8; // Webkit2
@@ -102,6 +113,10 @@ public class WebKitGTK extends C {
// Authentication.
public static final byte[] authenticate = ascii ("authenticate"); // $NON-NLS-1$ // Webkit1 & Webkit2
+ // TLS load failure signal
+ // Webkit2 only
+ public static final byte[] load_failed_with_tls_errors = ascii ("load-failed-with-tls-errors"); // $NON-NLS-1$
+
// Close webview
public static final byte[] close_web_view = ascii ("close-web-view"); // $NON-NLS-1$ // Webkit1
public static final byte[] close = ascii ("close"); // $NON-NLS-1$ // Webkit2
@@ -799,6 +814,18 @@ public static final void webkit_credential_free (long /*int*/ credential) {
}
}
+/** @method flags=dynamic */
+public static final native long /*int*/ _webkit_web_context_allow_tls_certificate_for_host(long /*int*/ webKitWebContext, long /*int*/ GTlsCertificate, byte[] constGCharHost);
+public static final long /*int*/ webkit_web_context_allow_tls_certificate_for_host(long /*int*/ webKitWebContext, long /*int*/ GTlsCertificate, byte[] constGCharHost) {
+ assert WEBKIT2 : Webkit2AssertMsg;
+ // since 2.6
+ lock.lock();
+ try {
+ return _webkit_web_context_allow_tls_certificate_for_host(webKitWebContext, GTlsCertificate, constGCharHost);
+ } finally {
+ lock.unlock();
+ }
+}
/** @method flags=dynamic */
public static final native long /*int*/ _webkit_web_context_get_type ();
@@ -1427,6 +1454,18 @@ public static final long /*int*/ webkit_web_context_set_favicon_database_directo
}
}
+/** @method flags=dynamic */
+public static final native void _webkit_web_context_set_tls_errors_policy(long /*int*/ context, int policy);
+public static final void webkit_web_context_set_tls_errors_policy (long /*int*/ context, int policy) {
+ assert WEBKIT2 : Webkit2AssertMsg;
+ lock.lock();
+ try {
+ _webkit_web_context_set_tls_errors_policy (context, policy);
+ } finally {
+ lock.unlock();
+ }
+}
+
/** @method flags=dynamic */
public static final native long /*int*/ _webkit_web_data_source_get_data (long /*int*/ data_source);
@@ -1598,6 +1637,18 @@ public static final long /*int*/ webkit_web_view_get_main_resource (long /*int*/
}
/** @method flags=dynamic */
+public static final native long /*int*/ _webkit_web_view_get_context (long /*int*/ web_view);
+public static final long /*int*/ webkit_web_view_get_context (long /*int*/ web_view) {
+ assert WEBKIT2 : Webkit2AssertMsg;
+ lock.lock();
+ try {
+ return _webkit_web_view_get_context (web_view);
+ } finally {
+ lock.unlock();
+ }
+}
+
+/** @method flags=dynamic */
public static final native int _webkit_web_view_can_go_forward (long /*int*/ web_view);
public static final int webkit_web_view_can_go_forward (long /*int*/ web_view) {
assert WEBKIT1 || WEBKIT2;
@@ -2171,4 +2222,5 @@ public static final long /*int*/ SoupMessage_request_headers (long /*int*/ messa
lock.unlock();
}
}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak b/bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak
index 648dcc4ecc..756b159b9a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak
@@ -10,5 +10,5 @@
#*******************************************************************************
maj_ver=4
-min_ver=880
-comma_ver=4,8,8,0
+min_ver=881
+comma_ver=4,8,8,1
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt b/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt
index 490ec7219f..a46f50beef 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt
@@ -1 +1 @@
-version 4.880 \ No newline at end of file
+version 4.881 \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties
index 94ffdca6f1..035cdf1cb5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties
@@ -82,6 +82,14 @@ SWT_InvalidCert_Message=The security certificate presented by "{0}" has problem(
SWT_InvalidCert_InvalidName=Certificate name is invalid or does not match site name. Certificate issued to: "{0}".
SWT_InvalidCert_NotValid=Certificate is not currently valid. Valid date range: "{0}".
SWT_InvalidCert_NotTrusted=Certificate is not from a trusted certifying authority. Certificate issuer: "{0}".
+SWT_InvalidCert_UnknownCA=The signing certificate authority is not known.
+SWT_InvalidCert_BadIdentity=The certificate does not match the expected identity of the site that it was retrieved from.
+SWT_InvalidCert_NotActivated=The certificate's activation time is still in the future.
+SWT_InvalidCert_Expired=The certificate has expired.
+SWT_InvalidCert_Revoked=The certificate has been revoked.
+SWT_InvalidCert_Insecure=The certificate's algorithm is considered insecure.
+SWT_InvalidCert_GenericError=Some other error occurred validating the certificate.
+SWT_InvalidCert_ValidateAll=This certificate has many errors.
SWT_InvalidCert_Connect=Would you like to connect to this site anyways?
SWT_OnBeforeUnload_Message1=Are you sure you want to leave this page?
SWT_OnBeforeUnload_Message2=Click OK to continue, or Cancel to stay on this page.
diff --git a/bundles/org.eclipse.swt/Readme.Win32.md b/bundles/org.eclipse.swt/Readme.Win32.md
index 696f3a0bbd..daa9a946ab 100644
--- a/bundles/org.eclipse.swt/Readme.Win32.md
+++ b/bundles/org.eclipse.swt/Readme.Win32.md
@@ -4,7 +4,7 @@ The document is structured so that you only need to read up to the point that yo
The SWT windows port is based on the Win32 api.
-The natives are compiled via an ant build.xml script with the Microsoft Visual Studio (2017) C++ compiler.
+The natives are compiled via an ant build.xml script with the Microsoft Visual Studio (2019) C++ compiler.
# Development overview
SWT is made up of 2 parts, Java and the natives (written in C).
@@ -37,16 +37,16 @@ libraries in the binary repository.
## (Advanced) Building Natives.
### Building just 64bit natives with no Webkit
-(Last Tested on Win10 64 bit & Java 9. March 2018):
+(Last tested on Win10 64 bit & Java 11. May 2019):
You need to install the following on your system:
* Microsoft Visual Studio - Community and Windows 10 SDK: (1*)
- https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Community&rel=15
- (I can't remember which components I installed, I cliked on items that seemed relevant for C/C++ development.
- I also installed the linux, but that might not be needed. My installation was around 20GB).
+ https://visualstudio.microsoft.com/vs/community/
+ Either select the components "MSVC C++-x64/x86-Buildtools" and "Windows 10 SDK"
+ or the workload "Desktop development with C++" which includes the required components and some more.
* (Optional) Install Cygwin
-* Install Java 8 or 9. Oracle JDK or IBM JDK:
+* Install Java 8 or 11. Oracle JDK or IBM JDK:
http://www.oracle.com/technetwork/java/javase/overview/java8-2100321.html
https://developer.ibm.com/javasdk/downloads/
@@ -56,7 +56,7 @@ In the binary git repo, in the windows project, you can build the natives via th
* In Eclipse, in the binary project org.eclipse.swt.win32.win32.x86_64, right click on build.xml:
* Run As -> Ant Build ...
-* on the Targets tab check the build_libraries target (it should be the only one check for just the natives).
+* On the Targets tab check the build_libraries target (it should be the only one check for just the natives).
* On the JRE tab select "Run in the same JRE as the workspace"
* On the Refresh tab check "Refresh resources upon completion" to refresh your workspace after running the build; this ensures that Eclipse will pick up the fresh binaries
* Press the "Run" button to begin.
diff --git a/bundles/org.eclipse.swt/buildSWT.xml b/bundles/org.eclipse.swt/buildSWT.xml
index d9fb2ca92e..4bb38f7375 100644
--- a/bundles/org.eclipse.swt/buildSWT.xml
+++ b/bundles/org.eclipse.swt/buildSWT.xml
@@ -59,7 +59,7 @@
<param name="fragment" value="org.eclipse.swt.cocoa.macosx.x86_64"/>
</antcall>
<antcall target="check_fragment_libraries">
- <param name="library_count" value="9"/>
+ <param name="library_count" value="8"/>
<param name="fragment" value="org.eclipse.swt.gtk.linux.ppc64"/>
</antcall>
<antcall target="check_fragment_libraries">
@@ -87,7 +87,7 @@
<target name="check_fragment_libraries" depends="get_version">
<echo>Checking ${fragment}</echo>
<property name="checkdir" value="~/build/check_libraries"/>
- <property name="library_count" value="48"/>
+ <property name="library_count" value="47"/>
<property name="fragment" value=""/>
<fileset id="match" dir="${repo.bin}/bundles/${fragment}" includes="**/org.eclipse.swt.gtk.linux.ppc64*/**, **/org.eclipse.swt.gtk.linux.x86*/**, **/org.eclipse.swt.win32.*/**, **/org.eclipse.swt.cocoa.macosx.*/**">
<filename regex="[0-9][0-9][0-9][0-9]."/>
diff --git a/bundles/org.eclipse.swt/pom.xml b/bundles/org.eclipse.swt/pom.xml
index 75d5e3deb5..c4e06b80f1 100644
--- a/bundles/org.eclipse.swt/pom.xml
+++ b/bundles/org.eclipse.swt/pom.xml
@@ -22,7 +22,7 @@
<version>3.107.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
- <forceContextQualifier>v20210329-2050</forceContextQualifier>
+ <forceContextQualifier>v20211029-1554</forceContextQualifier>
<sonar.sources>Eclipse SWT Accessibility/cocoa,Eclipse SWT Accessibility/common,Eclipse SWT Accessibility/gtk,Eclipse SWT Accessibility/win32,Eclipse SWT AWT/cocoa,Eclipse SWT AWT/common,Eclipse SWT AWT/gtk,Eclipse SWT AWT/win32,Eclipse SWT Browser/cocoa,Eclipse SWT Browser/common,Eclipse SWT Browser/gtk,Eclipse SWT Browser/win32,Eclipse SWT Custom Widgets/common,Eclipse SWT Drag and Drop/cocoa,Eclipse SWT Drag and Drop/common,Eclipse SWT Drag and Drop/gtk,Eclipse SWT Drag and Drop/win32,Eclipse SWT OLE Win32/win32,Eclipse SWT OpenGL/cocoa,Eclipse SWT OpenGL/common,Eclipse SWT OpenGL/glx,Eclipse SWT OpenGL/gtk,Eclipse SWT OpenGL/win32,Eclipse SWT PI/cairo,Eclipse SWT PI/cocoa,Eclipse SWT PI/common,Eclipse SWT PI/gtk,Eclipse SWT PI/win32,Eclipse SWT Printing/cocoa,Eclipse SWT Printing/common,Eclipse SWT Printing/gtk,Eclipse SWT Printing/win32,Eclipse SWT Program/cocoa,Eclipse SWT Program/common,Eclipse SWT Program/gtk,Eclipse SWT Program/win32,Eclipse SWT WebKit/cocoa,Eclipse SWT WebKit/gtk,Eclipse SWT WebKit/win32,Eclipse SWT/cairo,Eclipse SWT/cocoa,Eclipse SWT/common_j2se,Eclipse SWT/common,Eclipse SWT/emulated/bidi,Eclipse SWT/emulated/coolbar,Eclipse SWT/emulated/expand,Eclipse SWT/emulated/taskbar,Eclipse SWT/emulated/tooltip,Eclipse SWT/gtk,Eclipse SWT/win32</sonar.sources>
</properties>
<build>

Back to the top