Bug 1276927: Remove Bionic dependencies from Necko, r=valentin

B2G builds now use the header files from Android NDKs. Bionic is
not supported by the build any longer and Bionic features can't be
used anymore. This patch removes Necko's dependencies on Bionic
in favor of the respective Android code.

MozReview-Commit-ID: HP6jC22fLGn
This commit is contained in:
Thomas Zimmermann 2016-06-16 08:43:51 +01:00
parent ae77e30012
commit 92207a5fd9
2 changed files with 1 additions and 83 deletions

View File

@ -18,10 +18,6 @@
#include <algorithm>
#include "prerror.h"
#if defined(ANDROID) && ANDROID_VERSION > 19
#include <resolv_netid.h>
#endif
#include "mozilla/Logging.h"
#if DNSQUERY_AVAILABLE
@ -248,70 +244,6 @@ _GetTTLData_Windows(const char* aHost, uint16_t* aResult, uint16_t aAddressFamil
}
#endif
#if defined(ANDROID) && ANDROID_VERSION >= 19
// Make the same as nspr functions.
static MOZ_ALWAYS_INLINE PRAddrInfo*
_Android_GetAddrInfoForNetInterface(const char* hostname,
uint16_t af,
uint16_t flags,
const char* aNetworkInterface)
{
if ((af != PR_AF_INET && af != PR_AF_UNSPEC) ||
(flags & ~ PR_AI_NOCANONNAME) != PR_AI_ADDRCONFIG) {
PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
return nullptr;
}
struct addrinfo *res, hints;
int rv;
memset(&hints, 0, sizeof(hints));
if (!(flags & PR_AI_NOCANONNAME)) {
hints.ai_flags |= AI_CANONNAME;
}
#ifdef AI_ADDRCONFIG
if ((flags & PR_AI_ADDRCONFIG) &&
strcmp(hostname, "localhost") != 0 &&
strcmp(hostname, "localhost.localdomain") != 0 &&
strcmp(hostname, "localhost6") != 0 &&
strcmp(hostname, "localhost6.localdomain6") != 0) {
hints.ai_flags |= AI_ADDRCONFIG;
}
#endif
hints.ai_family = (af == PR_AF_INET) ? AF_INET : AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
#if ANDROID_VERSION == 19
rv = android_getaddrinfoforiface(hostname, NULL, &hints, aNetworkInterface,
0, &res);
#else
uint32_t netId = atoi(aNetworkInterface);
rv = android_getaddrinfofornet(hostname, NULL, &hints, netId, 0, &res);
#endif
#ifdef AI_ADDRCONFIG
if (rv == EAI_BADFLAGS && (hints.ai_flags & AI_ADDRCONFIG)) {
hints.ai_flags &= ~AI_ADDRCONFIG;
#if ANDROID_VERSION == 19
rv = android_getaddrinfoforiface(hostname, NULL, &hints, aNetworkInterface,
0, &res);
#else
uint32_t netId = atoi(aNetworkInterface);
rv = android_getaddrinfofornet(hostname, NULL, &hints, netId, 0, &res);
#endif
}
#endif
if (rv == 0) {
return (PRAddrInfo *) res;
}
PR_SetError(PR_DIRECTORY_LOOKUP_ERROR, rv);
return nullptr;
}
#endif
////////////////////////////////////
// PORTABLE RUNTIME IMPLEMENTATION//
////////////////////////////////////
@ -339,18 +271,7 @@ _GetAddrInfo_Portable(const char* aCanonHost, uint16_t aAddressFamily,
aAddressFamily = PR_AF_UNSPEC;
}
PRAddrInfo* prai;
#if defined(ANDROID) && ANDROID_VERSION >= 19
if (aNetworkInterface && aNetworkInterface[0] != '\0') {
prai = _Android_GetAddrInfoForNetInterface(aCanonHost,
aAddressFamily,
prFlags,
aNetworkInterface);
} else
#endif
{
prai = PR_GetAddrInfoByName(aCanonHost, aAddressFamily, prFlags);
}
PRAddrInfo* prai = PR_GetAddrInfoByName(aCanonHost, aAddressFamily, prFlags);
if (!prai) {
return NS_ERROR_UNKNOWN_HOST;

View File

@ -66,9 +66,6 @@ LOCAL_INCLUDES += [
'/netwerk/base',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['ANDROID_VERSION'] > '19':
LOCAL_INCLUDES += ['%' + '%s/bionic/libc/dns/include' % CONFIG['ANDROID_SOURCE']]
if CONFIG['ENABLE_INTL_API']:
DEFINES['IDNA2008'] = True
CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']