Closed
Bug 567628
Opened 15 years ago
Closed 14 years ago
inline schema XForms Error (2): Failed to process inline schema
Categories
(Core Graveyard :: XForms, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: christophe.geiser, Assigned: imphil)
Details
Attachments
(4 files, 1 obsolete file)
1.75 KB,
application/x-bzip
|
Details | |
1.55 KB,
application/xhtml+xml
|
Details | |
3.57 KB,
patch
|
doronr
:
review+
aaronr
:
review+
|
Details | Diff | Splinter Review |
12.81 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)
Build Identifier: xForms adds-on version 0.8.7
schema included directly in the xf:model are not loaded. Shema loaded from an external file are processed correctly though.
example of a form:
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<head>
<title>Validate Postal Codes</title>
<style type="text/css">
@namespace xf url("http://www.w3.org/2002/xforms");
xf|input {
display: table-row;
line-height: 2em;
}
xf|label {
display: table-cell;
text-align: right;
font-family: Arial, Helvetica, sans-serif;;
font-weight: bold;
padding-right: 5px;
width: 150px;
}
*:required {
background-color: yellow;
}
*:invalid {
background-color: pink;
}
</style>
<xf:model>
<xf:instance id="data" xmlns="">
<data >
<zip>12345</zip>
</data>
</xf:instance>
<xf:bind id="zip" required="true()" type="zipType" nodeset="zip" />
<xs:schema>
<xs:simpleType name="zipType">
<xs:restriction base="xs:string">
<xs:pattern value="\d{5}"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
</xf:model>
</head>
<body>
<xf:input bind="zip" incremental="true">
<xf:label>Zip Code: </xf:label>
<xf:hint>Validation is not correctly specified for this field</xf:hint>
<xf:alert>The 'Zip Code' failed to validate!</xf:alert>
</xf:input>
</body>
</html>
Reproducible: Always
Steps to Reproduce:
just load the form
Actual Results:
produces an xForms error; fields bound with types defined in the schema are not resolved.
Assignee | ||
Comment 1•15 years ago
|
||
It's (once again) the security principals. I'll look into it.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Assignee | ||
Comment 2•15 years ago
|
||
Assignee | ||
Comment 3•15 years ago
|
||
Assignee | ||
Comment 4•15 years ago
|
||
Assignee | ||
Comment 5•15 years ago
|
||
Assignee | ||
Comment 6•15 years ago
|
||
Usually we use the system principal for schema loads (done by LoadAsyncWithPrincipal()). This is necessary to support external xsd:include/xsd:import/xsd:redefine schemas.
Inline schemas are processed using nsSchemaLoader::ProcessSchemaElement, which tries to use the subject principal for its load (which is null, because we're not in a JS context). So the solution is to use the system principal for those loads as well. This principal is only consulted if an external schema has to be loaded, resulting in the same security considerations we had for external schemas.
I did some cleanups in the nsSchemaLoader code to make it easier to understand and attached a testcase which makes sure that we obey the same-origin policy when calling nsSchemaLoader from JavaScript.
Assignee: nobody → mail
Assignee | ||
Updated•15 years ago
|
Attachment #446997 -
Flags: review?(doronr)
Assignee | ||
Updated•15 years ago
|
Attachment #446998 -
Flags: review?(doronr)
Comment 7•14 years ago
|
||
Comment on attachment 446997 [details] [diff] [review]
schema-validation patch
looks good
Attachment #446997 -
Flags: review?(doronr) → review+
Updated•14 years ago
|
Attachment #446998 -
Flags: review?(doronr) → review+
Assignee | ||
Updated•14 years ago
|
Attachment #446997 -
Flags: review?(aaronr)
Assignee | ||
Updated•14 years ago
|
Attachment #446998 -
Flags: review?(aaronr)
Comment on attachment 446997 [details] [diff] [review]
schema-validation patch
Code looks good. However, before you check it in please correct the spacing in your patch to be consistent with the file that you are modifying. Looks like some places you indent 4 spaces, some places 2. Looks like the file is 2 spaces. Thanks.
Attachment #446997 -
Flags: review?(aaronr) → review+
Attachment #446998 -
Flags: review?(aaronr) → review+
Assignee | ||
Comment 9•14 years ago
|
||
r=doronr,aaronr (only whitespace fixes)
Alex, could you check this in please?
Attachment #446997 -
Attachment is obsolete: true
Comment 10•14 years ago
|
||
landed - http://hg.mozilla.org/xforms/rev/0e64d901bd20
http://hg.mozilla.org/schema-validation/rev/44f3007c3002
Status: ASSIGNED → RESOLVED
Closed: 14 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
•