diff options
author | Grant Gayed <ggayed> | 2011-01-13 16:01:19 +0000 |
---|---|---|
committer | Grant Gayed <ggayed> | 2011-01-13 16:01:19 +0000 |
commit | 722bc94f4f7e83a70c3470a84d80e9545657ad49 (patch) | |
tree | a0c223e08a0d537ff581f0248d570e06bec690da | |
parent | 25a820b9c61bce768cba2e9e95ac223905930030 (diff) | |
download | eclipse.platform.swt-722bc94f4f7e83a70c3470a84d80e9545657ad49.tar.gz eclipse.platform.swt-722bc94f4f7e83a70c3470a84d80e9545657ad49.tar.xz eclipse.platform.swt-722bc94f4f7e83a70c3470a84d80e9545657ad49.zip |
344161 - Eclipse crashes if link to PDF with anchor is clicked twice from Browser Widget
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java | 22 |
1 files changed, 21 insertions, 1 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 5331e1a489..d84e4465bf 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 @@ -105,6 +105,7 @@ class IE extends WebBrowser { static final String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$ static final String CLSID_SHELLEXPLORER1 = "{EAB22AC3-30C1-11CF-A7EB-0000C05BAE0B}"; //$NON-NLS-1$ static final String EXTENSION_PDF = ".pdf"; //$NON-NLS-1$ + static final String HTML_DOCUMENT = "HTML Document"; //$NON-NLS-1$ static final int MAX_PDF = 20; static final String EVENT_DOUBLECLICK = "dblclick"; //$NON-NLS-1$ @@ -1827,9 +1828,28 @@ void handleDOMEvent (OleEvent e) { } void hookDOMListeners(OleAutomation webBrowser, final boolean isTop) { - int[] rgdispid = webBrowser.getIDsOfNames(new String[] { PROPERTY_DOCUMENT }); + /* + * DOM listeners are only applicable when HTML content is shown. + * HTML documents always answer the Type property, so failure to get + * this value indicates that some other content type is being shown. + */ + int[] rgdispid = webBrowser.getIDsOfNames(new String[] { PROPERTY_TYPE }); + if (rgdispid == null) { + return; + } int dispIdMember = rgdispid[0]; Variant pVarResult = webBrowser.getProperty(dispIdMember); + if (pVarResult == null || pVarResult.getType() != COM.VT_BSTR) { + if (pVarResult != null) pVarResult.dispose (); + return; + } + String type = pVarResult.getString(); + pVarResult.dispose(); + if (!type.equals(HTML_DOCUMENT)) return; + + rgdispid = webBrowser.getIDsOfNames(new String[] { PROPERTY_DOCUMENT }); + dispIdMember = rgdispid[0]; + pVarResult = webBrowser.getProperty(dispIdMember); if (pVarResult == null) return; if (pVarResult.getType() == COM.VT_EMPTY) { pVarResult.dispose(); |