mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 766973: Don't allow synchronous DNS queries from the main thread. r=sworkman
This commit is contained in:
parent
6174824ed2
commit
64654ac744
@ -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<nsHostResolver> res;
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user