From 8a0040cf00206140a9128c56c76d6d5202519e15 Mon Sep 17 00:00:00 2001 From: "slamm%netscape.com" Date: Tue, 25 Sep 2007 00:37:44 +0000 Subject: [PATCH] Use standards compliant RDF format. Bug 41225. r=pavlov --- suite/common/sidebar/nsSidebar.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/suite/common/sidebar/nsSidebar.js b/suite/common/sidebar/nsSidebar.js index f9a4369285d..bc81a0f15fd 100644 --- a/suite/common/sidebar/nsSidebar.js +++ b/suite/common/sidebar/nsSidebar.js @@ -99,13 +99,19 @@ function (aTitle, aContentURL, aCustomizeURL) throw Components.results.NS_ERROR_NOT_INITIALIZED; } - /* Create a "container" wrapper around the - * "urn:sidebar:current-panel-list" object. This makes it easier - * to manipulate the RDF:Seq correctly. */ - var container = - Components.classes[CONTAINER_PROGID].createInstance(nsIRDFContainer); - container.Init(this.datasource, this.rdf.GetResource(this.resource)); - + // Create a "container" wrapper around the current panels to + // manipulate the RDF:Seq more easily. + var panel_list = this.datasource.GetTarget(this.rdf.GetResource(this.resource), this.rdf.GetResource(nsSidebar.prototype.nc+"panel-list"), true); + if (panel_list) { + panel_list.QueryInterface(Components.interfaces.nsIRDFResource); + } else { + // Datasource is busted. Start over. + debug("Sidebar datasource is busted\n"); + } + + var container = Components.classes[CONTAINER_PROGID].createInstance(nsIRDFContainer); + container.Init(this.datasource, panel_list); + /* Create a resource for the new panel and add it to the list */ var panel_resource = this.rdf.GetResource("urn:sidebar:3rdparty-panel:" + aContentURL);