зеркало из https://github.com/mozilla/pjs.git
xsd:anyURI validation doesn't allow relative urls, patch by sspeiche, r=me
This commit is contained in:
Родитель
1526092e92
Коммит
39493f2069
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче