diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java index 0bcc46d6cc6..483638503e4 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java @@ -13,6 +13,8 @@ *******************************************************************************/ package org.eclipse.swt.browser; +import java.net.*; + import org.eclipse.swt.*; import org.eclipse.swt.widgets.*; @@ -52,6 +54,7 @@ public class Browser extends Composite { static final String NO_INPUT_METHOD = "org.eclipse.swt.internal.gtk.noInputMethod"; //$NON-NLS-1$ static final String PACKAGE_PREFIX = "org.eclipse.swt.browser."; //$NON-NLS-1$ static final String PROPERTY_DEFAULTTYPE = "org.eclipse.swt.browser.DefaultType"; //$NON-NLS-1$ + private static final URI BASE_URI = URI.create("about:blank"); /** * Constructs a new instance of this class given its parent @@ -1201,4 +1204,16 @@ public void stop () { checkWidget(); webBrowser.stop (); } + +/** + * Checks if the location supplied is the location for setting custom text in the browser + * + * @param location the URL to be checked + * + * @since 3.127 + */ +public static boolean isLocationForCustomText(String location) { + return URI.create(location).equals(Browser.BASE_URI) + || location.startsWith("data:"); +} }