Closed Bug 86755 Opened 24 years ago Closed 24 years ago

anonymous outlinerbody's database property is null in containing XBL binding's constructor.

Categories

(Core Graveyard :: RDF, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED
mozilla0.9.9

People

(Reporter: murphye, Assigned: waterson)

References

Details

(Keywords: testcase)

Attachments

(4 files, 2 obsolete files)

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.1+) Gecko/20010618 BuildID: 2001061804 The summary says it all. Reproducible: Always Steps to Reproduce: Use the testcase, and view the dump.
Attached file roster.xml (testcase) (obsolete) —
Keywords: testcase
Also, using the same approach, except with the outliner being in the <children/>, I get the same result.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
OS: Windows NT → All
Priority: -- → P3
Hardware: PC → All
Target Milestone: --- → mozilla0.9.3
Could be pilot error, but I'm having a hard time getting outliner to work _at all_ as an XBL-ified widget. See bug 87860.
Depends on: 87860
Target Milestone: mozilla0.9.3 → mozilla0.9.4
My suspicion here is that you're accessing .database on outlinerbody before it exists. I created an example that accesses .database as the result of a button click, and it was non-null. Seems like something is fishy here, but it's probably possible to use any number of hacks to work around the issue. Resummarizing to reflect this.
Summary: outlinerbody database not present when used in XBL → anonymous outlinerbody's database property is null in containing XBL binding's constructor.
Yep, this is confusing. This is my hypothesis. I may be wrong. The problem appears to be because no frame has been created for the outlinerbody element. Description: 1) the outliner builder calls |SetView| on the outliner body frame, 2) this in turn calls |SetOutliner| on the outliner builder passing its outliner box object. 3) |SetOutliner| on the outliner builder calls |GetOutlinerBody| on the outliner box object passed to it. 4) In the <xbl:constructor/> of a binding containing an anonymous outliner, |GetOutlinerBody| returns null, as it is unable to get the frame for the outlinerbody element, as that has not yet been created. Well that's my debugging fun for the evening!
Target Milestone: mozilla0.9.4 → mozilla0.9.5
Target Milestone: mozilla0.9.5 → mozilla0.9.6
I found a good hack for this. Move the code from the binding's constructor to a method. Then in the document the binding is used in do window onload="thebinding.theMethod()" and that will execute the original constructor code after the outliner has loaded its database.
Target Milestone: mozilla0.9.6 → mozilla0.9.7
Target Milestone: mozilla0.9.7 → mozilla0.9.8
Target Milestone: mozilla0.9.8 → mozilla0.9.9
Yeah, what we need to do here is make nsXULTemplateBuilder (the super-class for nsXULOutlinerBuilder) inherit from nsIRDFContentModelBuilder. Then we'll just call nsIRDFContentModelBuilder::SetRootContent when we're in nsXULDocument::CheckTemplateBuilder, so that the |database| property gets initialized regardless of whether there's a frame or not.
Attached patch fix (obsolete) — Splinter Review
The problem was that we weren't adding the database property in the nsXULOutlinerBuilder until the frame was created and the outliner box object was being set. I fixed this by getting rid of nsIRDFContentModelBuilder (which wasn't really necessary), moving those methods to nsIXULTemplateBuilder, and having the initialization code in nsXULDocument::CheckTemplateBuilder simply call the `Init' method (formerly `SetRootContent') regardless of whether it was initializing a content builder or an outliner builder. I'll attach a test case that can be used to verify the bug.
Attachment #39211 - Attachment is obsolete: true
Save these files, and JAR them up into a chrome JAR somewhere. Then you'll be able to run the test and see the `dump' statement in the XBL file spew something other than `null'.
Keywords: review
Attached patch complete patchSplinter Review
Sorry, attachment 66068 [details] [diff] [review] was incomplete (missing diffs from mozilla/content/build). This patch is complete.
Attachment #66068 - Attachment is obsolete: true
Nice work! Now it looks even more consistent. This patch also fixes some problems I pointed out in bug 120253. + // Force an <outlinerchildren> to be created if one isn't + // there already. + // XXXwaterson why do we have to do this? I think this is only way how to create an outliner body for the rdfliner. r=varga
Attachment #66152 - Flags: review+
Gotcha. I'll fix the comment to say just that.
sr=hyatt
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
tever is not RDF QA anymore
QA Contact: tever → nobody
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: