xsd:anyURI validation doesn't allow relative urls, patch by sspeiche, r=me

This commit is contained in:
doronr%us.ibm.com 2006-09-19 17:29:41 +00:00
Родитель 1526092e92
Коммит 39493f2069
2 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -3440,8 +3440,12 @@ nsSchemaValidator::IsValidSchemaAnyURI(const nsAString & aString)
if (aString.IsEmpty()) {
isValid = PR_TRUE;
} else {
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), aString);
nsCOMPtr<nsIURI> uri, absUri;
// Need to supply a baseURI to allow relative URIs
NS_NewURI(getter_AddRefs(absUri), NS_LITERAL_STRING("http://a"));
nsresult rv = NS_NewURI(getter_AddRefs(uri), aString,
(const char*)nsnull, absUri);
if (rv == NS_OK)
isValid = PR_TRUE;

Просмотреть файл

@ -536,8 +536,10 @@
validate("http://www.foo.com", "anyuri-test-1", true);
validate("", "anyuri-test-1", true);
validate("f", "anyuri-test-1", false);
validate("bar..com", "anyuri-test-1", false);
validate("f", "anyuri-test-1", true);
validate("bar..com", "anyuri-test-1", true);
// XXX This should probably not validate
validate("http://ftp://#.#?###.", "anyuri-test-1", true);
validate("http://www.foo.com", "anyuri-test-2", true);
validate("http://www.f.com", "anyuri-test-2", false);