summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT Browser
diff options
context:
space:
mode:
authorGrant Gayed <grant_gayed@ca.ibm.com>2012-05-15 13:52:01 -0400
committerGrant Gayed <grant_gayed@ca.ibm.com>2012-05-15 13:55:36 -0400
commit3b7e04304effe884e33175739d7c3054dcac5e13 (patch)
tree2b62bd57433c2929844f00c7f5e464b32c7f36f1 /bundles/org.eclipse.swt/Eclipse SWT Browser
parentb6a1355efd8751a47f74a551d4a27ebea55b33b3 (diff)
downloadeclipse.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')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/LocationEvent.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java24
2 files changed, 24 insertions, 7 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/LocationEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/LocationEvent.java
index 0fed868b06..c500ee31b2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/LocationEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/LocationEvent.java
@@ -10,8 +10,8 @@
*******************************************************************************/
package org.eclipse.swt.browser;
-import org.eclipse.swt.widgets.*;
import org.eclipse.swt.events.*;
+import org.eclipse.swt.widgets.*;
/**
* A <code>LocationEvent</code> is sent by a {@link Browser} to
@@ -26,7 +26,10 @@ import org.eclipse.swt.events.*;
* @since 3.0
*/
public class LocationEvent extends TypedEvent {
- /** current location */
+ /**
+ * The URL of this event, escaped and encoded for consumption by
+ * {@link java.net.URI#URI(String)}.
+ */
public String location;
/**
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) {