As a security precaution, we have turned on the setting "Require API key authentication for API requests" for everyone. If this has broken something, please contact bugzilla-admin@mozilla.org
Last Comment Bug 340995 - complexType without complexContent fails validation
: complexType without complexContent fails validation
Status: RESOLVED FIXED
: fixed1.8.0.12, fixed1.8.1.4
Product: Core Graveyard
Classification: Graveyard
Component: XForms (show other bugs)
: Trunk
: x86 All
: -- normal (vote)
: ---
Assigned To: Steve Speicher
: Stephen Pride
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-06-09 12:14 PDT by aaronr
Modified: 2016-07-15 14:46 PDT (History)
2 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
testcase (3.66 KB, application/xhtml+xml)
2006-06-09 13:31 PDT, aaronr
no flags Details
allows empty content for complex types (8.53 KB, patch)
2007-02-22 13:00 PST, Steve Speicher
doronr: review+
aaronr: review+
Details | Diff | Splinter Review
patch with nits fixed, ready for checkin (8.43 KB, patch)
2007-03-06 07:05 PST, Steve Speicher
no flags Details | Diff | Splinter Review

Description User image aaronr 2006-06-09 12:14:54 PDT
If the user has a schema containing a complexType that does not contain complexContent or sequence, etc., then we will fail document validation inside nsSchemaValidator::ValidateComplextype.  The mContentType that we'll encounter will be nsISchemaComplexType::CONTENT_MODEL_EMPTY which is not implemented currently.
Comment 1 User image aaronr 2006-06-09 13:31:48 PDT
Created attachment 225054 [details]
testcase

testcase that shows the problem.  You won't see any problem visually, but if you go to the error console, you'll see that the error, "ERR: XForms Warning (3): Instance document did not validate"
Comment 2 User image Steve Speicher 2007-02-13 12:50:01 PST
I tested the associated test case with patch from bug 310962 (attachment 253149 [details] [diff] [review]) and it works.  Perhaps this bug depend on 310962?
Comment 3 User image aaronr 2007-02-13 18:01:25 PST
(In reply to comment #2)
> I tested the associated test case with patch from bug 310962 (attachment
> 253149 [details]) and it works.  Perhaps this bug depend on 310962?
> 

Looks like 310962 depends on trunk only features.  But perhaps we can use the piece of it that fixes this problem?  That might live only in the extension and thus be able to be checked into 1.8.
Comment 4 User image Steve Speicher 2007-02-22 13:00:59 PST
Created attachment 256069 [details] [diff] [review]
allows empty content for complex types
Comment 5 User image Doron Rosenberg (IBM) 2007-03-02 07:04:03 PST
Comment on attachment 256069 [details] [diff] [review]
allows empty content for complex types

looks good
Comment 6 User image aaronr 2007-03-02 13:09:00 PST
Comment on attachment 256069 [details] [diff] [review]
allows empty content for complex types

>Index: schema-validation/src/nsSchemaValidator.cpp
>===================================================================

> nsresult
>+nsSchemaValidator::ValidateComplexModelEmpty(nsIDOMNode* aNode,
>+                                    nsISchemaComplexType *aSchemaComplexType,
>+                                    PRBool *aResult)
>+{
>+  PRBool isValid = PR_TRUE;
>+  nsresult rv = NS_OK;
>+
>+  nsCOMPtr<nsIDOMNode> currentNode;
>+  aNode->GetFirstChild(getter_AddRefs(currentNode));
>+  NS_ENSURE_SUCCESS(rv, rv);

nit: why do you need rv?  You never use it.  Just return NS_OK at the end.

>Index: schema-validation/src/nsSchemaValidator.h
>===================================================================
>RCS file: /cvsroot/mozilla/extensions/schema-validation/src/nsSchemaValidator.h,v
>retrieving revision 1.10
>diff -u -8 -p -r1.10 nsSchemaValidator.h
>--- schema-validation/src/nsSchemaValidator.h	15 May 2006 21:34:38 -0000	1.10
>+++ schema-validation/src/nsSchemaValidator.h	22 Feb 2007 20:58:17 -0000
>@@ -298,16 +298,20 @@ private:
>   nsresult ValidateComplextype(nsIDOMNode *aNode,
>                                nsISchemaComplexType *aSchemaComplexType,
>                                PRBool *aResult);
> 
>   nsresult ValidateComplexModelElement(nsIDOMNode *aNode,
>                                        nsISchemaComplexType *aSchemaComplexType,
>                                        PRBool *aResult);
> 
>+  nsresult ValidateComplexModelEmpty(nsIDOMNode *aNode,
>+                              nsISchemaComplexType *aSchemaComplexType,
>+                              PRBool *aResult);
>+

nit: line up param types...looks like that is what the surrounding ones do.

with those, r=me
Comment 7 User image Steve Speicher 2007-03-06 07:05:54 PST
Created attachment 257507 [details] [diff] [review]
patch with nits fixed, ready for checkin

patch for checkin
Comment 8 User image Doron Rosenberg (IBM) 2007-03-07 07:20:49 PST
Fixed in trunk.  Does this need to go into any branches?
Comment 9 User image Steve Speicher 2007-03-07 08:07:29 PST
I'll just tag it xf-to-branch and can go with rest of XForms 0.8 items.  Thanks for the ci
Comment 10 User image aaronr 2007-04-23 16:15:58 PDT
checked into 1.8 branch on 2007-04-12
checked into 1.8.0 branch on 2007-04-16

Note You need to log in before you can comment on or make changes to this bug.