Closed Bug 272406 Opened 21 years ago Closed 21 years ago

External instance data not handled correctly

Categories

(Core Graveyard :: XForms, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.8beta1

People

(Reporter: allan, Assigned: smaug)

References

()

Details

Attachments

(1 file, 2 obsolete files)

nsXFormsInstanceElement receives two Load() events, and calls nsXFormsModelElement::InstanceLoadFinished() on the first call, which is premature, resulting in a too early nsXFormsModelElement::FinishConstruction().
Attached patch Quick fix (obsolete) — Splinter Review
Checks whether it's first load or not. It seems somewhat stupid to do it this way, but is there something in aEvent we could use?
Attachment #167424 - Flags: review?(smaug)
Status: NEW → ASSIGNED
Why are there two load events? Perhaps that indicates a gecko bug that we should be concerned about?
I confirm that this patch works. Again, though, I'm not sure why it is necessary.
OK, in my testing the problem is with the comment here: http://lxr.mozilla.org/mozilla/source/extensions/xforms/nsXFormsInstanceElement.cpp#76 It seems that CreateInstanceDocument does not fail, and so we actually end up loading the external instance document twice! :(
(In reply to comment #4) > OK, in my testing the problem is with the comment here: > http://lxr.mozilla.org/mozilla/source/extensions/xforms/nsXFormsInstanceElement.cpp#76 > > It seems that CreateInstanceDocument does not fail, and so we actually end up > loading the external instance document twice! :( Are you sure it loads both times? As far as I could see we only got the instance data on the last load. But, admitted, I did not use too much time on it.
Attached patch v2 patch (obsolete) — Splinter Review
This patch fixes the problem by ensuring that we ignore AttributeSet/Removed notifications until after DoneAddingChildren. The patch is fairly straightforward. I opted to use a boolean flag instead of attempting to modify the notification mask on the XTF element wrapper because 1) we have no backpointer to the XTF element wrapper, and 2) that would just be more code anyways.
Assignee: allan → darin
Attachment #167424 - Attachment is obsolete: true
Attachment #167608 - Flags: review?(smaug)
Attachment #167424 - Flags: review?(smaug)
Target Milestone: --- → mozilla1.8beta
(In reply to comment #6) > Created an attachment (id=167608) > v2 patch Looks good. In fact, most of our XForms elements should have this. Do any of them need to be informed about attribute changes before DoneAddingChildren is called?
What happens if you add xf:instance element dynamically and then modify the src attribute? mIgnoreAttributeChanges is set true on Ctor, but never to false because DoneAddingChildren() is called only during parsing.
> What happens if you add xf:instance element dynamically and then > modify the src attribute? > mIgnoreAttributeChanges is set true on Ctor, but never to false because > DoneAddingChildren() is called only during parsing. yup, i think that would be a problem. good catch. then, i think it means that we need your patch to move BeginAddingChildren up earlier before AttributeSet. another option would be to allow the thing to load from AttributeSet, and then remember that it had already started loading so we can then not bother loading it again in DoneAddingChildren. that might be better. thoughts?
Attachment #167608 - Flags: review?(smaug) → review-
(In reply to comment #9) > > another option would be to allow the thing to load from AttributeSet, and then > remember that it had already started loading so we can then not bother loading > it again in DoneAddingChildren. that might be better. thoughts? This sounds good.
Attached patch v3Splinter Review
But actually I prefer BeginAddingChildren. This way it is clear that the initialization of the instance document happens in DoneAddingChildren().
Assignee: darin → smaug
Attachment #167608 - Attachment is obsolete: true
Comment on attachment 167930 [details] [diff] [review] v3 patch v3 requires Bug 272814
Attachment #167930 - Flags: review?(darin)
Depends on: 272814
Attachment #167930 - Flags: review?(darin) → review+
fixed-on-trunk bug will be fixed for real once the patch for bug 272814 lands.
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: