mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 04:58:00 +00:00
Bug 88287; use the new GetDataSourceBlocking method to ensure we get the same data source as prefs is using; r=sgehani, sr=mscott
This commit is contained in:
parent
392d37499e
commit
d98e464a0f
@ -470,19 +470,8 @@ nsHelperAppDialog.prototype = {
|
||||
.getService( Components.interfaces.nsIProperties );
|
||||
var file = fileLocator.get( "UMimTyp", Components.interfaces.nsIFile );
|
||||
|
||||
// We must try creating a fresh remote DS in order to avoid accidentally
|
||||
// having GetDataSource trigger an asych load.
|
||||
var ds = Components.classes[ "@mozilla.org/rdf/datasource;1?name=xml-datasource" ].createInstance( Components.interfaces.nsIRDFDataSource );
|
||||
try {
|
||||
// Initialize it. This will fail if the uriloader (or anybody else)
|
||||
// has already loaded/registered this data source.
|
||||
var remoteDS = ds.QueryInterface( Components.interfaces.nsIRDFRemoteDataSource );
|
||||
remoteDS.Init( file.URL );
|
||||
remoteDS.Refresh( true );
|
||||
} catch ( all ) {
|
||||
// OK then, presume it was already registered; get it.
|
||||
ds = rdf.GetDataSource( file.URL );
|
||||
}
|
||||
// Get the data source; load it synchronously if it must be initialized.
|
||||
var ds = rdf.GetDataSourceBlocking( file.URL );
|
||||
|
||||
// Now check if this mimetype is really in there;
|
||||
// This is done by seeing if there's a "value" arc from the mimetype resource
|
||||
|
@ -177,10 +177,6 @@ nsresult nsExternalHelperAppService::InitDataSource()
|
||||
nsCOMPtr<nsIRDFService> rdf = do_GetService(kRDFServiceCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIRDFRemoteDataSource> remoteDS = do_CreateInstance(kRDFXMLDataSourceCID, &rv);
|
||||
mOverRideDataSource = do_QueryInterface(remoteDS);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// Get URI of the mimeTypes.rdf data source. Do this the same way it's done in
|
||||
// pref-applications-edit.xul, for example, to ensure we get the same data source!
|
||||
// Note that the way it was done previously (using nsIFileSpec) worked better, but it
|
||||
@ -194,13 +190,10 @@ nsresult nsExternalHelperAppService::InitDataSource()
|
||||
rv = mimeTypesFile->GetURL(getter_Copies(urlSpec));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = remoteDS->Init(urlSpec);
|
||||
// Get the data source; if it is going to be created, then load is synchronous.
|
||||
rv = rdf->GetDataSourceBlocking( urlSpec, getter_AddRefs( mOverRideDataSource ) );
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// for now load synchronously (async seems to be busted)
|
||||
rv = remoteDS->Refresh(PR_TRUE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed refresh?\n");
|
||||
|
||||
#ifdef DEBUG_mscott
|
||||
PRBool loaded;
|
||||
rv = remoteDS->GetLoaded(&loaded);
|
||||
|
Loading…
x
Reference in New Issue
Block a user