зеркало из https://github.com/mozilla/gecko-dev.git
xsd:anyURI validation doesn't allow relative urls, patch by sspeiche, r=me
This commit is contained in:
Родитель
bcb5fcb2c0
Коммит
1ecddd7c59
|
@ -3440,8 +3440,12 @@ nsSchemaValidator::IsValidSchemaAnyURI(const nsAString & aString)
|
||||||
if (aString.IsEmpty()) {
|
if (aString.IsEmpty()) {
|
||||||
isValid = PR_TRUE;
|
isValid = PR_TRUE;
|
||||||
} else {
|
} else {
|
||||||
nsCOMPtr<nsIURI> uri;
|
nsCOMPtr<nsIURI> uri, absUri;
|
||||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), aString);
|
|
||||||
|
// 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)
|
if (rv == NS_OK)
|
||||||
isValid = PR_TRUE;
|
isValid = PR_TRUE;
|
||||||
|
|
|
@ -536,8 +536,10 @@
|
||||||
|
|
||||||
validate("http://www.foo.com", "anyuri-test-1", true);
|
validate("http://www.foo.com", "anyuri-test-1", true);
|
||||||
validate("", "anyuri-test-1", true);
|
validate("", "anyuri-test-1", true);
|
||||||
validate("f", "anyuri-test-1", false);
|
validate("f", "anyuri-test-1", true);
|
||||||
validate("bar..com", "anyuri-test-1", false);
|
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.foo.com", "anyuri-test-2", true);
|
||||||
validate("http://www.f.com", "anyuri-test-2", false);
|
validate("http://www.f.com", "anyuri-test-2", false);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче