Closed
Bug 286630
Opened 20 years ago
Closed 20 years ago
nsSchemaLoader doesn't bail on invalid elements as direct children of xs:schema
Categories
(Core Graveyard :: Web Services, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: doronr, Assigned: doronr)
Details
Attachments
(2 files)
4.08 KB,
patch
|
peterv
:
superreview-
|
Details | Diff | Splinter Review |
4.85 KB,
patch
|
peterv
:
review+
peterv
:
superreview+
|
Details | Diff | Splinter Review |
Spec: http://www.w3.org/TR/xmlschema-1/#element-schema and
http://www.w3.org/TR/xmlschema-1/#Identity-constraint
http://lxr.mozilla.org/seamonkey/source/extensions/webservices/schema/src/nsSchemaLoader.cpp#858
We only fail if rv is failure, but we never handle unknown elements in the
if/else conditions.
Assignee | ||
Comment 1•20 years ago
|
||
Attachment #177766 -
Flags: superreview?(peterv)
Comment 2•20 years ago
|
||
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•20 years ago
|
||
fixed it and moved error firing to the else case.
Attachment #177880 -
Flags: superreview?(peterv)
Comment 4•20 years ago
|
||
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•20 years ago
|
||
checked in.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Updated•8 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•