Closed Bug 330660 Opened 20 years ago Closed 20 years ago

Template builder refuses to propagate assertions

Categories

(Core :: XUL, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: janv, Assigned: enndeakin)

Details

Attachments

(5 files)

Attached file testcase.xul
Attached file testcase.rdf
Neil, I slightly modified your patch in nsRDFPropertyTestNode.cpp - *aCantHandleYet = PR_TRUE; + *aCantHandleYet = PR_TRUE; + return NS_OK; I think we can safely return here, because we're doing the same thing in nsRDFConMemberTestNode.cpp and the method will be called again anyway.
Actually, I want to make a patch here which doesn't use default arguments.
ok, but the functionality will be the same?
Yes, the same thing, but change the FilterInstantiations to not use a default argument, and then fix up the callers. You can get bz or vlad to review the template code.
The issue occurs when we have, for example, a template with rules like ?a -> ?b ?b -> ?c ?a -> ?d When a new RDF assertion is made such that ?a -> ?d, the builder traverses up to fill in the remaining variables. This is done by the Constrain method. However, in the case above, it can't get any farther as neither ?b nor ?c are known. This patche changes the navigation to skip such underspecified rules and carry on to the next earlier step ?a -> ?b which can be filled in since ?a is known. The middle step will be filled in on the way back down.
Assignee: nobody → enndeakin
Status: NEW → ASSIGNED
Attachment #216348 - Flags: superreview?(bzbarsky)
Attachment #216348 - Flags: review?(bzbarsky)
Comment on attachment 216348 [details] [diff] [review] if a rule doesn't have every variable specified, skip it and try again on the way down >Index: content/xul/templates/src/nsContentTestNode.cpp >+nsContentTestNode::FilterInstantiations(InstantiationSet& aInstantiations, >+ PRBool* aCantHandleYet) const >+ > { > return NS_OK; Not setting out params and returning NS_OK is just not cool... Please set it as needed? >Index: content/xul/templates/src/nsRDFConInstanceTestNode.cpp Same. >Index: content/xul/templates/src/nsRDFConMemberTestNode.cpp Same for any codepath that doesn't hit the new code you added. > if (! hasContainerBinding && ! hasMemberBinding) { > // Neither container nor member assignment! >- NS_ERROR("can't do open ended queries like that!"); >- return NS_ERROR_UNEXPECTED; >+ if (!aCantHandleYet) { >+ return NS_ERROR_UNEXPECTED; Would it make sense to log a message to the JS console here? If so, followup bug on that? If not, all's good. >Index: content/xul/templates/src/nsRDFPropertyTestNode.cpp Same comments as for MemberTestNode. >Index: content/xul/templates/src/nsRuleNetwork.cpp > // if we still have instantiations, then ride 'em on up to the > // parent to narrow them. Does this comment need adjusting too? >Index: content/xul/templates/src/nsRuleNetwork.h >+ virtual nsresult FilterInstantiations(InstantiationSet& aInstantiations, >+ PRBool* aCantHandleYet) const = 0; Please document the new arg (especially that it's allowed to be null and hence isn't an XPCOM out param and what it means for it to be null). r+sr=bzbarsky with those nits picked.
Attachment #216348 - Flags: superreview?(bzbarsky)
Attachment #216348 - Flags: superreview+
Attachment #216348 - Flags: review?(bzbarsky)
Attachment #216348 - Flags: review+
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: