diff options
author | Grant Gayed <grant_gayed@ca.ibm.com> | 2012-05-15 13:52:01 -0400 |
---|---|---|
committer | Grant Gayed <grant_gayed@ca.ibm.com> | 2012-05-15 13:55:36 -0400 |
commit | 3b7e04304effe884e33175739d7c3054dcac5e13 (patch) | |
tree | 2b62bd57433c2929844f00c7f5e464b32c7f36f1 /bundles/org.eclipse.swt/Eclipse SWT Browser/win32 | |
parent | b6a1355efd8751a47f74a551d4a27ebea55b33b3 (diff) | |
download | eclipse.platform.swt-3b7e04304effe884e33175739d7c3054dcac5e13.tar.gz eclipse.platform.swt-3b7e04304effe884e33175739d7c3054dcac5e13.tar.xz eclipse.platform.swt-3b7e04304effe884e33175739d7c3054dcac5e13.zip |
Bug 368629 - IE Browser widget should always
encode LocationEvent#location
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Browser/win32')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java | 24 |
1 files changed, 19 insertions, 5 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 2a932269df..13cc2ae0de 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 @@ -472,12 +472,19 @@ public void create(Composite parent, int style) { /* * Feature in IE. For navigations on the local machine, BeforeNavigate2's url - * field contains a string representing the file path in a non-URL format. + * field contains a string representation of the file path in a non-URL format. * In order to be consistent with the other Browser implementations, this * case is detected and the string is changed to be a proper url string. */ if (url.indexOf(":/") == -1 && url.indexOf(":\\") != -1) { //$NON-NLS-1$ //$NON-NLS-2$ - url = PROTOCOL_FILE + url.replace('\\', '/'); + TCHAR filePath = new TCHAR(0, url, true); + TCHAR urlResult = new TCHAR(0, OS.INTERNET_MAX_URL_LENGTH); + int[] size = new int[] {urlResult.length()}; + if (!OS.IsWinCE && OS.UrlCreateFromPath(filePath, urlResult, size, 0) == COM.S_OK) { + url = urlResult.toString(0, size[0]); + } else { + url = PROTOCOL_FILE + url.replace('\\', '/'); + } } /* Disallow local file system accesses if the browser content is untrusted */ @@ -542,13 +549,20 @@ public void create(Composite parent, int style) { varResult = event.arguments[1]; String url = varResult.getString(); /* - * Bug in IE. For navigations on the local machine, DocumentComplete's URL - * field contains a string representing the file path in a non-URL format. + * Feature in IE. For navigations on the local machine, DocumentComplete's url + * field contains a string representation of the file path in a non-URL format. * In order to be consistent with the other Browser implementations, this * case is detected and the string is changed to be a proper url string. */ if (url.indexOf(":/") == -1 && url.indexOf(":\\") != -1) { //$NON-NLS-1$ //$NON-NLS-2$ - url = PROTOCOL_FILE + url.replace('\\', '/'); + TCHAR filePath = new TCHAR(0, url, true); + TCHAR urlResult = new TCHAR(0, OS.INTERNET_MAX_URL_LENGTH); + int[] size = new int[] {urlResult.length()}; + if (!OS.IsWinCE && OS.UrlCreateFromPath(filePath, urlResult, size, 0) == COM.S_OK) { + url = urlResult.toString(0, size[0]); + } else { + url = PROTOCOL_FILE + url.replace('\\', '/'); + } } if (html != null && url.equals(ABOUT_BLANK)) { if (delaySetText) { |