diff --git a/netwerk/dns/nsDNSService2.cpp b/netwerk/dns/nsDNSService2.cpp index 3bc5b5e38c9..e87094db13d 100644 --- a/netwerk/dns/nsDNSService2.cpp +++ b/netwerk/dns/nsDNSService2.cpp @@ -687,6 +687,15 @@ nsDNSService::Resolve(const nsACString &hostname, uint32_t flags, nsIDNSRecord **result) { + NS_WARNING("Do not use synchronous DNS resolution! This API may be removed soon."); + + // We will not allow this to be called on the main thread. This is transitional + // and a bit of a test for removing the synchronous API entirely. + if (NS_IsMainThread()) { + NS_ERROR("Synchronous DNS resolve failing - not allowed on the main thread!"); + return NS_ERROR_FAILURE; + } + // grab reference to global host resolver and IDN service. beware // simultaneous shutdown!! nsRefPtr res; diff --git a/netwerk/dns/nsIDNSService.idl b/netwerk/dns/nsIDNSService.idl index 159565de011..c24afb9a075 100644 --- a/netwerk/dns/nsIDNSService.idl +++ b/netwerk/dns/nsIDNSService.idl @@ -59,9 +59,8 @@ interface nsIDNSService : nsISupports in nsresult aReason); /** - * called to synchronously resolve a hostname. warning this method may - * block the calling thread for a long period of time. it is extremely - * unwise to call this function on the UI thread of an application. + * Called to synchronously resolve a hostname. This method will fail + * if called from the main thread. * * @param aHostName * the hostname or IP-address-literal to resolve.