Commit e722268d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

urlmon: Added support for javascript URIs.

parent 2ab3d226
......@@ -4192,7 +4192,81 @@ static const uri_properties uri_tests[] = {
{URLZONE_INVALID,E_NOTIMPL,FALSE}
}
},
{ "javascript:void", 0, S_OK, FALSE,
{
{"javascript:void",S_OK},
{"",S_FALSE},
{"javascript:void",S_OK},
{"",S_FALSE},
{"",S_FALSE},
{"",S_FALSE},
{"",S_FALSE},
{"",S_FALSE},
{"void",S_OK},
{"void",S_OK},
{"",S_FALSE},
{"javascript:void",S_OK},
{"javascript",S_OK},
{"",S_FALSE},
{"",S_FALSE}
},
{
{Uri_HOST_UNKNOWN,S_OK},
{0,S_FALSE},
{URL_SCHEME_JAVASCRIPT,S_OK},
{URLZONE_INVALID,E_NOTIMPL}
}
},
{ "javascript://undefined", 0, S_OK, FALSE,
{
{"javascript://undefined",S_OK},
{"",S_FALSE},
{"javascript://undefined",S_OK},
{"",S_FALSE},
{"",S_FALSE},
{"",S_FALSE},
{"",S_FALSE},
{"",S_FALSE},
{"//undefined",S_OK},
{"//undefined",S_OK},
{"",S_FALSE},
{"javascript://undefined",S_OK},
{"javascript",S_OK},
{"",S_FALSE},
{"",S_FALSE}
},
{
{Uri_HOST_UNKNOWN,S_OK},
{0,S_FALSE},
{URL_SCHEME_JAVASCRIPT,S_OK},
{URLZONE_INVALID,E_NOTIMPL}
}
},
{ "JavaSCript:escape('/\\?#?')", 0, S_OK, FALSE,
{
{"javascript:escape('/\\?#?')",S_OK},
{"",S_FALSE},
{"javascript:escape('/\\?#?')",S_OK},
{"",S_FALSE},
{"",S_FALSE},
{"",S_FALSE},
{"",S_FALSE},
{"",S_FALSE},
{"escape('/\\?#?')",S_OK},
{"escape('/\\?#?')",S_OK},
{"",S_FALSE},
{"JavaSCript:escape('/\\?#?')",S_OK},
{"javascript",S_OK},
{"",S_FALSE},
{"",S_FALSE}
},
{
{Uri_HOST_UNKNOWN,S_OK},
{0,S_FALSE},
{URL_SCHEME_JAVASCRIPT,S_OK},
{URLZONE_INVALID,E_NOTIMPL}
}
}
};
typedef struct _invalid_uri {
......
......@@ -2068,6 +2068,15 @@ static BOOL parse_path_opaque(const WCHAR **ptr, parse_data *data, DWORD flags)
static BOOL parse_hierpart(const WCHAR **ptr, parse_data *data, DWORD flags) {
const WCHAR *start = *ptr;
/* For javascript: URIs, simply set everything as a path */
if(data->scheme_type == URL_SCHEME_JAVASCRIPT) {
data->path = *ptr;
data->path_len = strlenW(*ptr);
data->is_opaque = TRUE;
*ptr += data->path_len;
return TRUE;
}
/* Checks if the authority information needs to be parsed. */
if(is_hierarchical_uri(ptr, data)) {
/* Only treat it as a hierarchical URI if the scheme_type is known or
......@@ -3079,6 +3088,15 @@ static BOOL canonicalize_path_opaque(const parse_data *data, Uri *uri, DWORD fla
uri->path_start = uri->canon_len;
/* For javascript: URIs, simply copy path part withoutany canonicalization */
if(data->scheme_type == URL_SCHEME_JAVASCRIPT) {
if(!computeOnly)
memcpy(uri->canon_uri+uri->canon_len, data->path, data->path_len*sizeof(WCHAR));
uri->path_len = data->path_len;
uri->canon_len += data->path_len;
return TRUE;
}
/* Windows doesn't allow a "//" to appear after the scheme
* of a URI, if it's an opaque URI.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment