summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt
diff options
context:
space:
mode:
authorGrant Gayed <ggayed>2008-06-27 19:41:45 +0000
committerGrant Gayed <ggayed>2008-06-27 19:41:45 +0000
commit6aa70af2b2255a8835f7c355b62ecd1f4b80e177 (patch)
tree4cd239afda425cdffd47e85d37c5e8b6643320f6 /bundles/org.eclipse.swt
parentfb0a54ecc21961877156b63a1966bffc49530779 (diff)
downloadeclipse.platform.swt-6aa70af2b2255a8835f7c355b62ecd1f4b80e177.tar.gz
eclipse.platform.swt-6aa70af2b2255a8835f7c355b62ecd1f4b80e177.tar.xz
eclipse.platform.swt-6aa70af2b2255a8835f7c355b62ecd1f4b80e177.zip
128184 - Browser : invalid certificate & HTTPS fails
Diffstat (limited to 'bundles/org.eclipse.swt')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Browser/cocoa/org/eclipse/swt/browser/Safari.java30
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/SWTMessages.properties1
6 files changed, 47 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/cocoa/org/eclipse/swt/browser/Safari.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/cocoa/org/eclipse/swt/browser/Safari.java
index 061ffa7dcc..806d3fe3fa 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/cocoa/org/eclipse/swt/browser/Safari.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/cocoa/org/eclipse/swt/browser/Safari.java
@@ -12,7 +12,7 @@ package org.eclipse.swt.browser;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.Callback;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.cocoa.*;
import org.eclipse.swt.widgets.*;
@@ -468,6 +468,34 @@ void webView_didFailProvisionalLoadWithError_forFrame(int sender, int error, int
*/
identifier = 0;
}
+
+ NSError nserror = new NSError(error);
+ int errorCode = nserror.code();
+ if (errorCode <= OS.NSURLErrorBadURL) {
+ NSString description = nserror.localizedDescription();
+ if (description != null) {
+ char[] buffer = new char[description.length()];
+ description.getCharacters_(buffer);
+ String descriptionString = new String(buffer);
+ String urlString = null;
+ NSDictionary info = nserror.userInfo();
+ if (info != null) {
+ NSString key = new NSString(OS.NSErrorFailingURLStringKey());
+ id id = info.valueForKey(key);
+ if (id != null) {
+ NSString url = new NSString(id.id);
+ buffer = new char[url.length()];
+ url.getCharacters_(buffer);
+ urlString = new String(buffer);
+ }
+ }
+ String message = urlString != null ? urlString + "\n\n" : ""; //$NON-NLS-1$ //$NON-NLS-2$
+ message += Compatibility.getMessage ("SWT_Page_Load_Failed", new Object[] {descriptionString}); //$NON-NLS-1$
+ MessageBox messageBox = new MessageBox(browser.getShell(), SWT.OK | SWT.ICON_ERROR);
+ messageBox.setMessage(message);
+ messageBox.open();
+ }
+ }
}
void webView_didFinishLoadForFrame(int sender, int frameID) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
index 063ec1c042..ba727deeac 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
@@ -384,6 +384,18 @@ JNIEXPORT jint JNICALL OS_NATIVE(NSDeviceResolution)
}
#endif
+#ifndef NO_NSErrorFailingURLStringKey
+JNIEXPORT jint JNICALL OS_NATIVE(NSErrorFailingURLStringKey)
+ (JNIEnv *env, jclass that)
+{
+ jint rc = 0;
+ OS_NATIVE_ENTER(env, that, NSErrorFailingURLStringKey_FUNC);
+ rc = (jint)NSErrorFailingURLStringKey;
+ OS_NATIVE_EXIT(env, that, NSErrorFailingURLStringKey_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_NSFileTypeForHFSTypeCode
JNIEXPORT jint JNICALL OS_NATIVE(NSFileTypeForHFSTypeCode)
(JNIEnv *env, jclass that, jint arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
index 340a10da02..496d18a5a3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
@@ -14,8 +14,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 328;
-int OS_nativeFunctionCallCount[328];
+int OS_nativeFunctionCount = 329;
+int OS_nativeFunctionCallCount[329];
char * OS_nativeFunctionNames[] = {
"CGWarpMouseCursorPosition",
"CloseRgn",
@@ -38,6 +38,7 @@ char * OS_nativeFunctionNames[] = {
"NSDefaultRunLoopMode",
"NSDeviceRGBColorSpace",
"NSDeviceResolution",
+ "NSErrorFailingURLStringKey",
"NSFileTypeForHFSTypeCode",
"NSFontAttributeName",
"NSForegroundColorAttributeName",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
index 85274c92c6..93587f2400 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
@@ -46,6 +46,7 @@ typedef enum {
NSDefaultRunLoopMode_FUNC,
NSDeviceRGBColorSpace_FUNC,
NSDeviceResolution_FUNC,
+ NSErrorFailingURLStringKey_FUNC,
NSFileTypeForHFSTypeCode_FUNC,
NSFontAttributeName_FUNC,
NSForegroundColorAttributeName_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
index 9a6f2d2ba2..166ff617ea 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
@@ -9912,7 +9912,7 @@ public static final native int NSDefaultRunLoopMode();
//public static final native int NSDistinctUnionOfArraysKeyValueOperator();
//public static final native int NSDistinctUnionOfObjectsKeyValueOperator();
//public static final native int NSDistinctUnionOfSetsKeyValueOperator();
-//public static final native int NSErrorFailingURLStringKey();
+public static final native int NSErrorFailingURLStringKey();
//public static final native int NSFailedAuthenticationException();
//public static final native int NSFileAppendOnly();
//public static final native int NSFileBusy();
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 6f5b8da521..6ecf39a219 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
@@ -73,3 +73,4 @@ SWT_Download_Started=Downloading...
SWT_Download_Status=Download: {0,number,integer} KB of {1,number,integer} KB
SWT_Authentication_Required=Authentication Required
SWT_Enter_Username_and_Password=Enter user name and password for {0} at {1}
+SWT_Page_Load_Failed=Page load failed with error: {0} \ No newline at end of file