Closed Bug 330252 Opened 19 years ago Closed 19 years ago

Expose a .getInstanceDoc() on instance element

Categories

(Core Graveyard :: XForms, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: allan, Assigned: surkov)

References

()

Details

(Keywords: fixed1.8.0.4, fixed1.8.1)

Attachments

(2 files, 1 obsolete file)

If you via script run through a document, find an instance element and want to inspect its instance document, you have to note its ID and then go to the model element to ask for the instance document via the ID. It seems a bit awkward to me. How about creating a scriptable function that returns the document directly on the instance itself? interface nsIXFormsInstanceElement : nsISupports { nsIDOMDocument getInstanceDocument(); } And yes, somebody (I...) should make an effort to push some of these extensions to the WG...
Attached patch patch (obsolete) (deleted) — Splinter Review
Attachment #214869 - Flags: review?(allan)
Attached file testcase (deleted) —
Comment on attachment 214869 [details] [diff] [review] patch >+[scriptable, uuid(80669B92-8331-4f92-AAF8-06E80E6827B3)] I think this needs to be small caps. Change nsIInstanceElementPrivate to have a setInstanceDocument() function instead of the current attribute, and (naturally) change the callers. We should only have one function for getting the document. (and remember to create a new uuid for nsIInstanceElementPrivate then).
Attachment #214869 - Flags: review?(allan) → review-
Do we need a security check - only allow getInstanceDoc to work if the same-origin check succeeds? js could then access documents from any domain using this...
(In reply to comment #4) > Do we need a security check - only allow getInstanceDoc to work if the > same-origin check succeeds? > > js could then access documents from any domain using this... > A .js author trying to use getInstanceDoc() will only be able to get the same instance document that XForms already loaded (and which the script author already has access to via model.getInstanceDocument('id')). XForms uses the CheckSameOrigin code in nsXFormsInstanceElement::LoadExternalInstance (http://lxr.mozilla.org/mozilla/source/extensions/xforms/nsXFormsInstanceElement.cpp#510) so we already offer some level of protection for the user from cross domain instance loading.
Attached patch patch2 (deleted) — Splinter Review
Attachment #214869 - Attachment is obsolete: true
Attachment #214968 - Flags: review?(allan)
Attachment #214968 - Flags: review?(aaronr)
Comment on attachment 214968 [details] [diff] [review] patch2 yessir. r=me
Attachment #214968 - Flags: review?(allan) → review+
Assignee: aaronr → surkov
Status: NEW → ASSIGNED
Attachment #214968 - Flags: review?(aaronr) → review+
checked into trunk for surkov
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Whiteboard: xf-to-branch
Blocks: 330790
Blocks: 332853
Whiteboard: xf-to-branch
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: