nsSchemaLoader doesn't bail on invalid elements as direct children of xs:schema

RESOLVED FIXED

Status

Core Graveyard
Web Services
RESOLVED FIXED
13 years ago
3 months ago

People

(Reporter: Doron Rosenberg (IBM), Assigned: Doron Rosenberg (IBM))

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Assignee)

Comment 1

13 years ago
Created attachment 177766 [details] [diff] [review]
1.0
Attachment #177766 - Flags: superreview?(peterv)
Comment on attachment 177766 [details] [diff] [review]
1.0

>Index: extensions/webservices/schema/src/nsSchemaLoader.cpp
>===================================================================

>+    } else if ((tagName != nsSchemaAtoms::sAnnotation_atom) &&
>+               (tagName != nsSchemaAtoms::sInclude_atom) &&
>+               (tagName != nsSchemaAtoms::sImport_atom) &&
>+               (tagName != nsSchemaAtoms::sRedefine_atom) &&
>+               (tagName != nsSchemaAtoms::sNotation_atom) &&
>+               (tagName != nsSchemaAtoms::sAnnotation_atom) &&
>+               (tagName != nsSchemaAtoms::sUnique_atom) &&
>+               (tagName != nsSchemaAtoms::sKey_atom) &&
>+               (tagName != nsSchemaAtoms::sKeyref_atom) &&
>+               (tagName != nsSchemaAtoms::sSelector_atom) &&
>+               (tagName != nsSchemaAtoms::sField_atom)) {

You have sAnnotation__atom twice. I don't think the identity-constraint
elements should be in this if, the comment probably indicates that they're
ignored in ProcessElement etc. but they're not valid children of the schema
element.
And drop the inner braces, they're not needed.

>     if (NS_FAILED(rv)) {
>       nsAutoString elementName;
>       nsresult rc = aElement->GetTagName(elementName);
>       NS_ENSURE_SUCCESS(rc, rc);
> 
>       nsAutoString errorMsg;
>       errorMsg.AppendLiteral("Failure processing schema, unexpected element \"");
>       errorMsg.Append(elementName);
>       errorMsg.AppendLiteral("\" in <schema .../>");

Bah, this error message is shown for all errors, even those unrelated to
unexpected elements.
Attachment #177766 - Flags: superreview?(peterv) → superreview-
(Assignee)

Comment 3

13 years ago
Created attachment 177880 [details] [diff] [review]
v 2

fixed it and moved error firing to the else case.
Attachment #177880 - Flags: superreview?(peterv)
Comment on attachment 177880 [details] [diff] [review]
v 2

>Index: extensions/webservices/schema/src/nsSchemaAtomList.h
>===================================================================

> SCHEMA_ATOM(sPattern_atom, "pattern")
>+

No need to add this newline.

>Index: extensions/webservices/schema/src/nsSchemaLoader.cpp
>===================================================================

>+    } else if (tagName != nsSchemaAtoms::sAnnotation_atom &&

    }
    else if {
Attachment #177880 - Flags: superreview?(peterv)
Attachment #177880 - Flags: superreview+
Attachment #177880 - Flags: review+
(Assignee)

Comment 5

13 years ago
checked in.
Status: NEW → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → FIXED

Updated

3 months ago
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.