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)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: christophe.geiser, Assigned: imphil)

Details

Attachments

(4 files, 1 obsolete file)

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.
It's (once again) the security principals. I'll look into it.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attached patch schema-validation patch (obsolete) — Splinter Review
Attached patch xforms patchSplinter Review
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
Attachment #446997 - Flags: review?(doronr)
Attachment #446998 - Flags: review?(doronr)
Comment on attachment 446997 [details] [diff] [review] schema-validation patch looks good
Attachment #446997 - Flags: review?(doronr) → review+
Attachment #446998 - Flags: review?(doronr) → review+
Attachment #446997 - Flags: review?(aaronr)
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+
r=doronr,aaronr (only whitespace fixes) Alex, could you check this in please?
Attachment #446997 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: