Closed Bug 264991 Opened 21 years ago Closed 21 years ago

Support xforms submission replace attribute

Categories

(Core Graveyard :: XForms, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.8beta1

People

(Reporter: darin.moz, Assigned: darin.moz)

References

Details

Attachments

(1 file)

Support xforms submission replace attribute. see file:///home/darinf/packages/xforms-spec/slice11.html#submit-event
Attached patch v1 patchSplinter Review
This patch takes a simplistic approach to xforms submission. Instead, of using a different loader for each type of replacement, I use Necko directly to load the submission response into a memory buffer (a pipe). Then I process the data in the pipe. For replace='all', I use nsIDocShell::loadStream, and for replace='instance', I use nsIDOMParser::parseFromStream. This seems to work well, and should be fine for reasonably sized responses. We may wish to optimize replace='all' in the future by calling nsIDocShell::loadStream from within OnStartRequest before all of the data has been downloaded. This would require some careful wrangling of object ownership, etc., but I think it could be done. In the future, we could also invent a way to invoke the DOM parser on a sequence of data chunks. Or, maybe we could create a special interface for that. The benefits of the current solution is that we don't have N different codepaths leading up to calling AsyncOpen. Using document.load is not a good option since it does not provide a way to configure the upload stream. And, using webnavigation.loadURI is not a good option either because it does not give us a way to abort the replacement of the current page if the resulting document is empty (that's an xforms requirement!) -- see bug 263084, which becomes somewhat obsolete by this patch.
Attachment #162535 - Flags: review?(bryner)
Blocks: 263086
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.8beta
+ // create a pipe in which to store the response hmm, wouldn't nsIStreamLoader be easier?
(In reply to comment #2) > + // create a pipe in which to store the response > > hmm, wouldn't nsIStreamLoader be easier? yes, but the pipe uses much more optimal storage. nsIStreamLoader forces all of the content into a continguous buffer, whereas nsIDOMParser and nsIDocShell can load content from a nsIInputStream, which can be a segmented buffer (which is what nsPipe implements).
Attachment #162535 - Flags: review?(bryner) → review+
fixed-on-trunk
Status: ASSIGNED → RESOLVED
Closed: 21 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

Creator:
Created:
Updated:
Size: