Creates an instance. @param url a string representing an absolute or relative URL. If url is a relative URL, base is required, and will be used as the base URL. If url is an absolute URL, a given base will be ignored. @param base a string representing the base URL to use in case url
(final String url, final Object base)
| 58 | * is a relative URL. If not specified, it defaults to ''. |
| 59 | */ |
| 60 | @JsxConstructor |
| 61 | @JsxConstructorAlias(alias = "webkitURL") |
| 62 | public void jsConstructor(final String url, final Object base) { |
| 63 | String baseStr = null; |
| 64 | if (!JavaScriptEngine.isUndefined(base)) { |
| 65 | baseStr = JavaScriptEngine.toString(base); |
| 66 | } |
| 67 | |
| 68 | try { |
| 69 | if (org.htmlunit.util.StringUtils.isBlank(baseStr)) { |
| 70 | url_ = UrlUtils.toUrlUnsafe(url); |
| 71 | } |
| 72 | else { |
| 73 | final java.net.URL baseUrl = UrlUtils.toUrlUnsafe(baseStr); |
| 74 | url_ = UrlUtils.toUrlUnsafe(UrlUtils.resolveUrl(baseUrl, url)); |
| 75 | } |
| 76 | url_ = UrlUtils.removeRedundantPort(url_); |
| 77 | } |
| 78 | catch (final MalformedURLException e) { |
| 79 | throw JavaScriptEngine.typeError(e.toString()); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * The URL.createObjectURL() static method creates a DOMString containing a URL |
nothing calls this directly
no test coverage detected