Open Bug 302090 Opened 20 years ago Updated 3 years ago

nsXULTemplateBuilder : Refresh boolean parameter request (synchronous or asynchronous) for RDF reloading and XUL Elements

Categories

(Core :: XUL, defect)

x86
Linux
defect

Tracking

()

People

(Reporter: sberthelot, Unassigned)

Details

(Keywords: helpwanted)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr-FR; rv:1.7.10) Gecko/20050716 Firefox/1.0.6 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; fr-FR; rv:1.7.10) Gecko/20050716 Firefox/1.0.6 When updating a live RDF source (generated in PHP) with element.builder.refresh() I just after select an item in the XUL menulist that has the datasource with element.selectedIndex=0; It seems the datasource loads asynchronously then the selection comes to early and the menupopup is not generated. Having a boolean argument (that is directly passed to the datasource.Refresh(boolean async) http://lxr.mozilla.org/mozilla/source/content/xul/templates/src/nsXULTemplateBuilder.cpp#269 function could allow a javascript function to wait for the load completion and select items after) I have tried with a Listener but it seems it still arrives too fast (before completion on menupopup nodes generation) and trying to get the datasource object to call Resfresh(true) on it requires more evelated privileges (which I think shouldn't be needed for that kind of operation) By the way I also get "Error : uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIMenuBoxObject.activeChild]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://global/content/bindings/menulist.xml :: onxblpopupshowing :: line 43" data: no]" at first time opening the popup after having reloaded the datasource... Reproducible: Always Steps to Reproduce: (see details also) 1. Design a menulist/menupopup with template and a dynamic RDF datasource 2. Call a javascript function to reload the datasource (element.builder.refresh()) 3. make a selection on the same element quicly after (element.selectedIndex=0) Actual Results: (see details) Got "Error : uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIMenuBoxObject.activeChild]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://global/content/bindings/menulist.xml :: onxblpopupshowing :: line 43" data: no]" and the item is not selected (selectedIndex==-1) Expected Results: Wait for datasource refresh completion. Maybe allow to prepare items in menupopup children nodes (not lazily, a method would be great for that) then allow directly after those calls to set selectedIndex without having to require more privileges to get the datasource and attach an observer to it ... I would personnaly change to http://lxr.mozilla.org/mozilla/source/content/xul/templates/src/nsXULTemplateBuilder.cpp#254 -nsXULTemplateBuilder::Refresh() +nsXULTemplateBuilder::Refresh(PRBOOL aBlocking) - rds->Refresh(PR_FALSE); + rds->Refresh(aBlocking);
Component: General → XP Toolkit/Widgets: XUL
Product: Firefox → Core
QA Contact: general → xptoolkit.xul
Version: unspecified → Trunk
Neil, is this something we want to support?
The refresh method is supposed to be temporary until rdf becomes scriptable. Adding support for blocking refresh will mean that a remote site can block the UI. If that's acceptable, then I don't see any reason not to support this change.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: helpwanted
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets
Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.