rem: try { profileService  = Components.classes['component: profileService = profileService.QueryInterface(Components.interfaces.nsIProfile); var sidebar_url = profileService.getCurrentProfileDirFromJS(); sidebar_url.URLString += "sidebar.rdf";  if (!(sidebar_url.exists())) {  } else {  defaultsidebar.db = sidebar_url.URLString; } } catch (ex) {  } sidebar = defaultsidebar; 
add: try { var profileInterface = Components.interfaces.nsIProfile var profileURI = 'component: var profileService  = Components.classes[profileURI].getService() profileService = profileService.QueryInterface(profileInterface) var sidebar_url = profileService.getCurrentProfileDirFromJS() sidebar_url.URLString += "sidebar.rdf"  if (!(sidebar_url.exists())) {   } else {  defaultsidebar.db = sidebar_url.URLString } } catch (ex) {  } sidebar = defaultsidebar 
context: function sidebarOverlayInit(usersidebar){  // load up user-specified sidebar  if (usersidebar) {    //dump("usersidebar = " + usersidebar + "\n");    //dump("usersidebar.resource = " + usersidebar.resource + "\n");    //dump("usersidebar.db = " + usersidebar.db + "\n");    sidebar = usersidebar;  }   else {                  	  try 	  {		profileService  = Components.classes['component://netscape/profile/manager'].getService();		profileService = profileService.QueryInterface(Components.interfaces.nsIProfile);		var sidebar_url = profileService.getCurrentProfileDirFromJS();		sidebar_url.URLString += "sidebar.rdf";	      		if (!(sidebar_url.exists())) {			//dump("using " + defaultsidebar.db + " because " + sidebar_url.URLString + " does not exist\n");		}		else {			//dump("sidebar url is " + sidebar_url.URLString + "\n");			defaultsidebar.db = sidebar_url.URLString;		}	  }	  catch (ex) 	  {		//dump("failed to get sidebar url, using default\n");	  }  	sidebar = defaultsidebar;  }  var sidebar_element = document.getElementById('sidebarbox');  if (sidebar_element.getAttribute('hidden')) {    return  }  //dump("sidebar = " + sidebar + "\n");  //dump("sidebar.resource = " + sidebar.resource + "\n");  //dump("sidebar.db = " + sidebar.db + "\n");  var registry  try {    // First try to construct a new one and load it    // synchronously. nsIRDFService::GetDataSource() loads RDF/XML    // asynchronously by default.    var xmlsrc = 'component://netscape/rdf/datasource?name=xml-datasource'    registry = Components.classes[xmlsrc].createInstance()    registry = registry.QueryInterface(Components.interfaces.nsIRDFDataSource)    var remote = Components.interfaces.nsIRDFRemoteDataSource    remote = registry.QueryInterface(remote)    // this will throw if it's already been opened and registered.    remote.Init(sidebar.db)    // read it in synchronously.    remote.Refresh(true)  }  catch (ex) {    // if we get here, then the RDF/XML has been opened and read    // once. We just need to grab the datasource.    registry = RDF.GetDataSource(sidebar.db)  }  // Create a 'container' wrapper around the sidebar.resources  // resource so we can use some utility routines that make access a  // bit easier.  var sb_datasource = Components.classes['component://netscape/rdf/container']  var container    = Components.interfaces.nsIRDFContainer  try {	  sb_datasource     = sb_datasource.createInstance()	  sb_datasource     = sb_datasource.QueryInterface(container)	  sb_datasource.Init(registry, RDF.GetResource(sidebar.resource))  }  catch (ex) {	//dump("failed to init sb_datasource\n");  }    var mypanelsbox = document.getElementById('sidebarpanels')  // Now enumerate all of the flash datasources.  var enumerator = null;  try {	enumerator = sb_datasource.GetElements()  }  catch (ex) {	//dump("sb_datasource has no elements.\n");  }  if (!enumerator) return;  while (enumerator.HasMoreElements()) {    var service = enumerator.GetNext()    service = service.QueryInterface(Components.interfaces.nsIRDFResource)    var is_last = !enumerator.HasMoreElements()    var new_panel = addSidebarPanel(mypanelsbox, registry, service, is_last)  }}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/93ae0f0b0547d8acd44a2ec5ce42b29ea606a4ef/sidebarOverlay.js/buggy/xpfe/components/sidebar/resources/sidebarOverlay.js