summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Gayed <ggayed>2009-10-14 20:12:24 +0000
committerGrant Gayed <ggayed>2009-10-14 20:12:24 +0000
commit8c499e7f548c5a7014e7831f20a1d25d6ab6fa7c (patch)
treed18070364a766f7796a989b4f2dafb07519d5957
parent27cff172583c60e83c9e053f2d2330c4077bbec9 (diff)
downloadeclipse.platform.swt-8c499e7f548c5a7014e7831f20a1d25d6ab6fa7c.tar.gz
eclipse.platform.swt-8c499e7f548c5a7014e7831f20a1d25d6ab6fa7c.tar.xz
eclipse.platform.swt-8c499e7f548c5a7014e7831f20a1d25d6ab6fa7c.zip
291486 - Browser widget crashes VM after failed Ctrl+L in hover
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java23
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java1
3 files changed, 22 insertions, 16 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java
index 16c010d80e..19ebdb16b3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java
@@ -36,7 +36,7 @@ class IE extends WebBrowser {
int style, lastKeyCode, lastCharCode;
int lastMouseMoveX, lastMouseMoveY;
- static boolean IsIE7;
+ static int IEVersion;
static String ProgId = "Shell.Explorer"; //$NON-NLS-1$
static final int BeforeNavigate2 = 0xfa;
@@ -188,13 +188,11 @@ class IE extends WebBrowser {
int index = versionString.indexOf ("."); //$NON-NLS-1$
if (index != -1) {
String majorString = versionString.substring (0, index);
- int major = 0;
try {
- major = Integer.valueOf (majorString).intValue ();
+ IEVersion = Integer.valueOf (majorString).intValue ();
} catch (NumberFormatException e) {
/* just continue, version-specific features will not be enabled */
}
- IsIE7 = major >= 7;
}
}
}
@@ -948,13 +946,13 @@ public boolean setText(String html) {
int[] rgdispidNamedArgs = new int[1];
rgdispidNamedArgs[0] = rgdispid[1];
boolean oldValue = false;
- if (!OS.IsWinCE && IsIE7) {
+ if (!OS.IsWinCE && IEVersion >= 7) {
int hResult = OS.CoInternetIsFeatureEnabled(OS.FEATURE_DISABLE_NAVIGATION_SOUNDS, OS.GET_FEATURE_FROM_PROCESS);
oldValue = hResult == COM.S_OK;
OS.CoInternetSetFeatureEnabled(OS.FEATURE_DISABLE_NAVIGATION_SOUNDS, OS.SET_FEATURE_ON_PROCESS, true);
}
Variant pVarResult = auto.invoke(rgdispid[0], rgvarg, rgdispidNamedArgs);
- if (!OS.IsWinCE && IsIE7) {
+ if (!OS.IsWinCE && IEVersion >= 7) {
OS.CoInternetSetFeatureEnabled(OS.FEATURE_DISABLE_NAVIGATION_SOUNDS, OS.SET_FEATURE_ON_PROCESS, oldValue);
}
rgvarg[0].dispose();
@@ -988,13 +986,13 @@ public boolean setUrl(String url) {
int[] rgdispidNamedArgs = new int[1];
rgdispidNamedArgs[0] = rgdispid[1];
boolean oldValue = false;
- if (!OS.IsWinCE && IsIE7) {
+ if (!OS.IsWinCE && IEVersion >= 7) {
int hResult = OS.CoInternetIsFeatureEnabled(OS.FEATURE_DISABLE_NAVIGATION_SOUNDS, OS.GET_FEATURE_FROM_PROCESS);
oldValue = hResult == COM.S_OK;
OS.CoInternetSetFeatureEnabled(OS.FEATURE_DISABLE_NAVIGATION_SOUNDS, OS.SET_FEATURE_ON_PROCESS, true);
}
auto.invoke(rgdispid[0], rgvarg, rgdispidNamedArgs);
- if (!OS.IsWinCE && IsIE7) {
+ if (!OS.IsWinCE && IEVersion >= 7) {
OS.CoInternetSetFeatureEnabled(OS.FEATURE_DISABLE_NAVIGATION_SOUNDS, OS.SET_FEATURE_ON_PROCESS, oldValue);
}
rgvarg[0].dispose();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java
index 0c2bc056d7..38571fafba 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java
@@ -311,10 +311,14 @@ int TranslateAccelerator(int /*long*/ lpMsg, int /*long*/ pguidCmdGroup, int nCm
}
}
/*
- * By default the IE shortcuts are run. However, F5 causes a refresh, which is not
- * appropriate when rendering HTML from memory, and CTRL-N opens a standalone IE,
- * which is undesirable and can cause a crash in some contexts. The workaround is
- * to block IE from handling these shortcuts by answering COM.S_OK.
+ * By default the IE shortcuts are run. However, the shortcuts below should not run
+ * in this context. The workaround is to block IE from handling these shortcuts by
+ * answering COM.S_OK.
+ *
+ * - F5 causes a refresh, which is not appropriate when rendering HTML from memory
+ * - CTRL+L opens an Open Location dialog in IE8, which is undesirable and can
+ * crash in some contexts
+ * - CTRL+N opens a standalone IE, which is undesirable and can crash in some contexts
*/
int result = COM.S_FALSE;
MSG msg = new MSG();
@@ -348,11 +352,14 @@ int TranslateAccelerator(int /*long*/ lpMsg, int /*long*/ pguidCmdGroup, int nCm
* handler.
*/
break;
+ case OS.VK_L:
case OS.VK_N:
if (OS.GetKeyState (OS.VK_CONTROL) < 0 && OS.GetKeyState (OS.VK_MENU) >= 0 && OS.GetKeyState (OS.VK_SHIFT) >= 0) {
- frame.setData(CONSUME_KEY, "false"); //$NON-NLS-1$
- result = COM.S_OK;
- break;
+ if (msg.wParam == OS.VK_N || IE.IEVersion >= 8) {
+ frame.setData(CONSUME_KEY, "false"); //$NON-NLS-1$
+ result = COM.S_OK;
+ break;
+ }
}
// FALL THROUGH
default:
@@ -568,7 +575,7 @@ boolean canExecuteApplets () {
* executing applets with IE6 embedded can crash, so do not
* attempt this if the version is less than IE7
*/
- if (!IE.IsIE7) return false;
+ if (IE.IEVersion < 7) return false;
if (canExecuteApplets == null) {
WebBrowser webBrowser = ((Browser)getParent ().getParent ()).webBrowser;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
index e56cc5e24c..4af75c003e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
@@ -1936,6 +1936,7 @@ public class OS extends C {
public static final int VK_F9 = 0x78;
public static final int VK_HOME = 0x24;
public static final int VK_INSERT = 0x2d;
+ public static final int VK_L = 0x4c;
public static final int VK_LBUTTON = 0x1;
public static final int VK_LEFT = 0x25;
public static final int VK_MBUTTON = 0x4;