diff options
Diffstat (limited to 'netwerk')
29 files changed, 14 insertions, 624 deletions
diff --git a/netwerk/base/moz.build b/netwerk/base/moz.build index 5de1eea81..3198d746c 100644 --- a/netwerk/base/moz.build +++ b/netwerk/base/moz.build @@ -182,11 +182,6 @@ EXPORTS.mozilla.net += [ 'ReferrerPolicy.h', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - EXPORTS += [ - 'NetStatistics.h', - ] - UNIFIED_SOURCES += [ 'ArrayBufferInputStream.cpp', 'BackgroundFileSaver.cpp', diff --git a/netwerk/base/nsILoadGroup.idl b/netwerk/base/nsILoadGroup.idl index 4f89bd0e3..d0cad5ece 100644 --- a/netwerk/base/nsILoadGroup.idl +++ b/netwerk/base/nsILoadGroup.idl @@ -95,10 +95,4 @@ interface nsILoadGroup : nsIRequest * the docShell has created the default request.) */ attribute nsLoadFlags defaultLoadFlags; - - /** - * The cached user agent override created by UserAgentOverrides.jsm. Used - * for all sub-resource requests in the loadgroup. - */ - attribute ACString userAgentOverrideCache; }; diff --git a/netwerk/base/nsIOService.cpp b/netwerk/base/nsIOService.cpp index 8b7f31f99..e13541acf 100644 --- a/netwerk/base/nsIOService.cpp +++ b/netwerk/base/nsIOService.cpp @@ -59,11 +59,6 @@ #include "nsContentUtils.h" #include "xpcpublic.h" -#ifdef MOZ_WIDGET_GONK -#include "nsINetworkManager.h" -#include "nsINetworkInterface.h" -#endif - namespace mozilla { namespace net { diff --git a/netwerk/base/nsIncrementalDownload.cpp b/netwerk/base/nsIncrementalDownload.cpp index 42cd6faa5..47f7cb98b 100644 --- a/netwerk/base/nsIncrementalDownload.cpp +++ b/netwerk/base/nsIncrementalDownload.cpp @@ -49,27 +49,6 @@ WriteToFile(nsIFile *lf, const char *data, uint32_t len, int32_t flags) PRFileDesc *fd; int32_t mode = 0600; nsresult rv; -#if defined(MOZ_WIDGET_GONK) - // The sdcard on a B2G phone looks like: - // d---rwx--- system sdcard_rw 1970-01-01 01:00:00 sdcard - // On the emulator, xpcshell fails when using 0600 mode to open the file, - // and 0660 works. - nsCOMPtr<nsIFile> parent; - rv = lf->GetParent(getter_AddRefs(parent)); - if (NS_FAILED(rv)) { - return rv; - } - uint32_t parentPerm; - rv = parent->GetPermissions(&parentPerm); - if (NS_FAILED(rv)) { - return rv; - } - if ((parentPerm & 0700) == 0) { - // Parent directory has no owner-write, so try to use group permissions - // instead of owner permissions. - mode = 0660; - } -#endif rv = lf->OpenNSPRFileDesc(flags, mode, &fd); if (NS_FAILED(rv)) return rv; diff --git a/netwerk/base/nsLoadGroup.cpp b/netwerk/base/nsLoadGroup.cpp index 7b75f7942..51d5a9ca7 100644 --- a/netwerk/base/nsLoadGroup.cpp +++ b/netwerk/base/nsLoadGroup.cpp @@ -809,20 +809,6 @@ nsLoadGroup::SetDefaultLoadFlags(uint32_t aFlags) return NS_OK; } -NS_IMETHODIMP -nsLoadGroup::GetUserAgentOverrideCache(nsACString & aUserAgentOverrideCache) -{ - aUserAgentOverrideCache = mUserAgentOverrideCache; - return NS_OK; -} - -NS_IMETHODIMP -nsLoadGroup::SetUserAgentOverrideCache(const nsACString & aUserAgentOverrideCache) -{ - mUserAgentOverrideCache = aUserAgentOverrideCache; - return NS_OK; -} - //////////////////////////////////////////////////////////////////////////////// diff --git a/netwerk/base/nsLoadGroup.h b/netwerk/base/nsLoadGroup.h index da89ca1b3..20dd94cf9 100644 --- a/netwerk/base/nsLoadGroup.h +++ b/netwerk/base/nsLoadGroup.h @@ -95,8 +95,6 @@ protected: /* For nsPILoadGroupInternal */ uint32_t mTimedNonCachedRequestsUntilOnEndPageLoad; - - nsCString mUserAgentOverrideCache; }; } // namespace net diff --git a/netwerk/base/nsNetUtil.cpp b/netwerk/base/nsNetUtil.cpp index bc9bcf88a..d60c909c5 100644 --- a/netwerk/base/nsNetUtil.cpp +++ b/netwerk/base/nsNetUtil.cpp @@ -71,11 +71,6 @@ #include "nsHttpHandler.h" #include "nsNSSComponent.h" -#ifdef MOZ_WIDGET_GONK -#include "nsINetworkManager.h" -#include "nsThreadUtils.h" // for NS_IsMainThread -#endif - #include <limits> using namespace mozilla; diff --git a/netwerk/base/nsUDPSocket.cpp b/netwerk/base/nsUDPSocket.cpp index 84f6b8ea5..5973a205d 100644 --- a/netwerk/base/nsUDPSocket.cpp +++ b/netwerk/base/nsUDPSocket.cpp @@ -31,10 +31,6 @@ #include "nsIDNSService.h" #include "nsICancelable.h" -#ifdef MOZ_WIDGET_GONK -#include "NetStatistics.h" -#endif - namespace mozilla { namespace net { @@ -626,15 +622,6 @@ nsUDPSocket::InitWithAddress(const NetAddr *aAddr, nsIPrincipal *aPrincipal, aPrincipal->GetIsInIsolatedMozBrowserElement(); } -#ifdef MOZ_WIDGET_GONK - if (mAppId != NECKO_UNKNOWN_APP_ID) { - nsCOMPtr<nsINetworkInfo> activeNetworkInfo; - GetActiveNetworkInfo(activeNetworkInfo); - mActiveNetworkInfo = - new nsMainThreadPtrHolder<nsINetworkInfo>(activeNetworkInfo); - } -#endif - uint16_t port; if (NS_FAILED(net::GetPort(aAddr, &port))) { NS_WARNING("invalid bind address"); @@ -770,29 +757,7 @@ nsUDPSocket::GetLocalAddr(nsINetAddr * *aResult) void nsUDPSocket::SaveNetworkStats(bool aEnforce) { -#ifdef MOZ_WIDGET_GONK - if (!mActiveNetworkInfo || mAppId == NECKO_UNKNOWN_APP_ID) { - return; - } - - if (mByteReadCount == 0 && mByteWriteCount == 0) { - return; - } - - uint64_t total = mByteReadCount + mByteWriteCount; - if (aEnforce || total > NETWORK_STATS_THRESHOLD) { - // Create the event to save the network statistics. - // the event is then dispathed to the main thread. - RefPtr<Runnable> event = - new SaveNetworkStatsEvent(mAppId, mIsInIsolatedMozBrowserElement, mActiveNetworkInfo, - mByteReadCount, mByteWriteCount, false); - NS_DispatchToMainThread(event); - - // Reset the counters after saving. - mByteReadCount = 0; - mByteWriteCount = 0; - } -#endif + /*** STUB ***/ } void diff --git a/netwerk/base/nsUDPSocket.h b/netwerk/base/nsUDPSocket.h index 4ddff4248..f8ae87cee 100644 --- a/netwerk/base/nsUDPSocket.h +++ b/netwerk/base/nsUDPSocket.h @@ -12,11 +12,6 @@ #include "nsAutoPtr.h" #include "nsCycleCollectionParticipant.h" -#ifdef MOZ_WIDGET_GONK -#include "nsINetworkInterface.h" -#include "nsProxyRelease.h" -#endif - //----------------------------------------------------------------------------- namespace mozilla { @@ -76,9 +71,6 @@ private: uint64_t mByteReadCount; uint64_t mByteWriteCount; -#ifdef MOZ_WIDGET_GONK - nsMainThreadPtrHandle<nsINetworkInfo> mActiveNetworkInfo; -#endif }; //----------------------------------------------------------------------------- diff --git a/netwerk/dns/mdns/libmdns/moz.build b/netwerk/dns/mdns/libmdns/moz.build index d2dca4955..efad64d64 100644 --- a/netwerk/dns/mdns/libmdns/moz.build +++ b/netwerk/dns/mdns/libmdns/moz.build @@ -4,8 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' or \ - (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['ANDROID_VERSION'] >= '16'): +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': UNIFIED_SOURCES += [ 'MDNSResponderOperator.cpp', 'MDNSResponderReply.cpp', @@ -16,13 +15,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' or \ '/netwerk/base', ] - if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - LOCAL_INCLUDES += [ - '%' + '%s/%s' % (CONFIG['ANDROID_SOURCE'], d) for d in [ - 'external/mdnsresponder/mDNSShared', - ] - ] - else: EXTRA_COMPONENTS += [ 'nsDNSServiceDiscovery.js', diff --git a/netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.cpp b/netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.cpp index 8ffa74b71..cec8033d1 100644 --- a/netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.cpp +++ b/netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.cpp @@ -9,10 +9,6 @@ #include "nsXULAppAPI.h" #include "private/pprio.h" -#ifdef MOZ_WIDGET_GONK -#include <cutils/properties.h> -#endif // MOZ_WIDGET_GONK - namespace mozilla { namespace net { @@ -21,29 +17,13 @@ namespace { inline void StartService() { -#ifdef MOZ_WIDGET_GONK - char value[PROPERTY_VALUE_MAX] = { '\0' }; - property_get("init.svc.mdnsd", value, ""); - - if (strcmp(value, "running") == 0) { - return; - } - property_set("ctl.start", "mdnsd"); -#endif // MOZ_WIDGET_GONK + /*** STUB ***/ } inline void StopService() { -#ifdef MOZ_WIDGET_GONK - char value[PROPERTY_VALUE_MAX] = { '\0' }; - property_get("init.svc.mdnsd", value, ""); - - if (strcmp(value, "stopped") == 0) { - return; - } - property_set("ctl.stop", "mdnsd"); -#endif // MOZ_WIDGET_GONK + /*** STUB ***/ } class ServiceCounter @@ -157,9 +137,6 @@ NS_IMPL_ISUPPORTS(nsDNSServiceDiscovery, nsIDNSServiceDiscovery) nsDNSServiceDiscovery::~nsDNSServiceDiscovery() { -#ifdef MOZ_WIDGET_GONK - StopService(); -#endif } nsresult diff --git a/netwerk/dns/mdns/libmdns/nsMulticastDNSModule.cpp b/netwerk/dns/mdns/libmdns/nsMulticastDNSModule.cpp index 22bad3bc7..aa1c973b5 100644 --- a/netwerk/dns/mdns/libmdns/nsMulticastDNSModule.cpp +++ b/netwerk/dns/mdns/libmdns/nsMulticastDNSModule.cpp @@ -3,7 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#if defined(MOZ_WIDGET_COCOA) || (defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 16) +#if defined(MOZ_WIDGET_COCOA) #define ENABLE_DNS_SERVICE_DISCOVERY #endif diff --git a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp index 1119fcff5..2ae12846a 100644 --- a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp +++ b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp @@ -45,10 +45,6 @@ #include "nsIAuthPrompt2.h" #include "nsIFTPChannelParentInternal.h" -#ifdef MOZ_WIDGET_GONK -#include "NetStatistics.h" -#endif - using namespace mozilla; using namespace mozilla::net; @@ -1619,13 +1615,6 @@ nsFtpState::Init(nsFtpChannel *channel) // initialize counter for network metering mCountRecv = 0; -#ifdef MOZ_WIDGET_GONK - nsCOMPtr<nsINetworkInfo> activeNetworkInfo; - GetActiveNetworkInfo(activeNetworkInfo); - mActiveNetworkInfo = - new nsMainThreadPtrHolder<nsINetworkInfo>(activeNetworkInfo); -#endif - mKeepRunning = true; mSuppliedEntityID = channel->EntityID(); @@ -2104,43 +2093,7 @@ nsFtpState::ReadSegments(nsWriteSegmentFun writer, void *closure, nsresult nsFtpState::SaveNetworkStats(bool enforce) { -#ifdef MOZ_WIDGET_GONK - // Obtain app id - uint32_t appId; - bool isInBrowser; - NS_GetAppInfo(mChannel, &appId, &isInBrowser); - - // Check if active network and appid are valid. - if (!mActiveNetworkInfo || appId == NECKO_NO_APP_ID) { - return NS_OK; - } - - if (mCountRecv <= 0) { - // There is no traffic, no need to save. - return NS_OK; - } - - // If |enforce| is false, the traffic amount is saved - // only when the total amount exceeds the predefined - // threshold. - if (!enforce && mCountRecv < NETWORK_STATS_THRESHOLD) { - return NS_OK; - } - - // Create the event to save the network statistics. - // the event is then dispathed to the main thread. - RefPtr<Runnable> event = - new SaveNetworkStatsEvent(appId, isInBrowser, mActiveNetworkInfo, - mCountRecv, 0, false); - NS_DispatchToMainThread(event); - - // Reset the counters after saving. - mCountRecv = 0; - - return NS_OK; -#else return NS_ERROR_NOT_IMPLEMENTED; -#endif } NS_IMETHODIMP diff --git a/netwerk/protocol/ftp/nsFtpConnectionThread.h b/netwerk/protocol/ftp/nsFtpConnectionThread.h index dd48da562..b4e71bd10 100644 --- a/netwerk/protocol/ftp/nsFtpConnectionThread.h +++ b/netwerk/protocol/ftp/nsFtpConnectionThread.h @@ -17,11 +17,6 @@ #include "nsFtpControlConnection.h" #include "nsIProtocolProxyCallback.h" -#ifdef MOZ_WIDGET_GONK -#include "nsINetworkInterface.h" -#include "nsProxyRelease.h" -#endif - // ftp server types #define FTP_GENERIC_TYPE 0 #define FTP_UNIX_TYPE 1 @@ -215,11 +210,7 @@ private: bool mDeferredCallbackPending; // These members are used for network per-app metering (bug 855948) -// Currently, they are only available on gonk. uint64_t mCountRecv; -#ifdef MOZ_WIDGET_GONK - nsMainThreadPtrHandle<nsINetworkInfo> mActiveNetworkInfo; -#endif nsresult SaveNetworkStats(bool); void CountRecvBytes(uint64_t recvBytes) { diff --git a/netwerk/protocol/http/UserAgentOverrides.jsm b/netwerk/protocol/http/UserAgentOverrides.jsm index 22c676f06..037aa575b 100644 --- a/netwerk/protocol/http/UserAgentOverrides.jsm +++ b/netwerk/protocol/http/UserAgentOverrides.jsm @@ -46,9 +46,9 @@ this.UserAgentOverrides = { Services.prefs.addObserver(PREF_OVERRIDES_ENABLED, buildOverrides, false); try { - Services.obs.addObserver(HTTP_on_useragent_request, "http-on-useragent-request", false); + Services.obs.addObserver(HTTP_on_modify_request, "http-on-modify-request", false); } catch (x) { - // The http-on-useragent-request notification is disallowed in content processes. + // The http-on-modify-request notification is disallowed in content processes. } UserAgentUpdates.init(function(overrides) { @@ -118,7 +118,7 @@ this.UserAgentOverrides = { Services.prefs.removeObserver(PREF_OVERRIDES_ENABLED, buildOverrides); - Services.obs.removeObserver(HTTP_on_useragent_request, "http-on-useragent-request"); + Services.obs.removeObserver(HTTP_on_modify_request, "http-on-modify-request"); }, receiveMessage: function(aMessage) { @@ -169,7 +169,7 @@ function buildOverrides() { } } -function HTTP_on_useragent_request(aSubject, aTopic, aData) { +function HTTP_on_modify_request(aSubject, aTopic, aData) { let channel = aSubject.QueryInterface(Ci.nsIHttpChannel); for (let callback of gOverrideFunctions) { diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 05699df62..9107b16e8 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -6031,8 +6031,6 @@ nsHttpChannel::BeginConnect() // notify "http-on-modify-request" observers CallOnModifyRequestObservers(); - SetLoadGroupUserAgentOverride(); - // Check if request was cancelled during on-modify-request or on-useragent. if (mCanceled) { return mStatus; @@ -8400,50 +8398,6 @@ nsHttpChannel::MaybeWarnAboutAppCache() } void -nsHttpChannel::SetLoadGroupUserAgentOverride() -{ - nsCOMPtr<nsIURI> uri; - GetURI(getter_AddRefs(uri)); - nsAutoCString uriScheme; - if (uri) { - uri->GetScheme(uriScheme); - } - - // We don't need a UA for file: protocols. - if (uriScheme.EqualsLiteral("file")) { - gHttpHandler->OnUserAgentRequest(this); - return; - } - - nsIRequestContextService* rcsvc = gHttpHandler->GetRequestContextService(); - nsCOMPtr<nsIRequestContext> rc; - if (rcsvc) { - rcsvc->GetRequestContext(mRequestContextID, - getter_AddRefs(rc)); - } - - nsAutoCString ua; - if (nsContentUtils::IsNonSubresourceRequest(this)) { - gHttpHandler->OnUserAgentRequest(this); - if (rc) { - GetRequestHeader(NS_LITERAL_CSTRING("User-Agent"), ua); - rc->SetUserAgentOverride(ua); - } - } else { - GetRequestHeader(NS_LITERAL_CSTRING("User-Agent"), ua); - // Don't overwrite the UA if it is already set (eg by an XHR with explicit UA). - if (ua.IsEmpty()) { - if (rc) { - rc->GetUserAgentOverride(ua); - SetRequestHeader(NS_LITERAL_CSTRING("User-Agent"), ua, false); - } else { - gHttpHandler->OnUserAgentRequest(this); - } - } - } -} - -void nsHttpChannel::SetDoNotTrack() { /** diff --git a/netwerk/protocol/http/nsHttpChannel.h b/netwerk/protocol/http/nsHttpChannel.h index 7578b1173..cb8925d04 100644 --- a/netwerk/protocol/http/nsHttpChannel.h +++ b/netwerk/protocol/http/nsHttpChannel.h @@ -460,8 +460,6 @@ private: void MaybeWarnAboutAppCache(); - void SetLoadGroupUserAgentOverride(); - void SetDoNotTrack(); private: diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index 67e29a029..f9bcc391d 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -848,31 +848,6 @@ nsHttpHandler::InitUserAgentComponents() } #endif // MOZ_MULET -#if defined(MOZ_WIDGET_GONK) - // Device model identifier should be a simple token, which can be composed - // of letters, numbers, hyphen ("-") and dot ("."). - // Any other characters means the identifier is invalid and ignored. - nsCString deviceId; - rv = Preferences::GetCString("general.useragent.device_id", &deviceId); - if (NS_SUCCEEDED(rv)) { - bool valid = true; - deviceId.Trim(" ", true, true); - for (size_t i = 0; i < deviceId.Length(); i++) { - char c = deviceId.CharAt(i); - if (!(isalnum(c) || c == '-' || c == '.')) { - valid = false; - break; - } - } - if (valid) { - mDeviceModelId = deviceId; - } else { - LOG(("nsHttpHandler: Ignore invalid device ID: [%s]\n", - deviceId.get())); - } - } -#endif - #ifndef MOZ_UA_OS_AGNOSTIC // Gather OS/CPU. #if defined(XP_WIN) diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h index 35b14a511..0904af893 100644 --- a/netwerk/protocol/http/nsHttpHandler.h +++ b/netwerk/protocol/http/nsHttpHandler.h @@ -280,12 +280,6 @@ public: NotifyObservers(chan, NS_HTTP_ON_MODIFY_REQUEST_TOPIC); } - // Called by the channel and cached in the loadGroup - void OnUserAgentRequest(nsIHttpChannel *chan) - { - NotifyObservers(chan, NS_HTTP_ON_USERAGENT_REQUEST_TOPIC); - } - // Called by the channel once headers are available void OnExamineResponse(nsIHttpChannel *chan) { diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp index 706710d89..8d837d172 100644 --- a/netwerk/protocol/http/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/nsHttpTransaction.cpp @@ -43,10 +43,6 @@ #include "sslerr.h" #include <algorithm> -#ifdef MOZ_WIDGET_GONK -#include "NetStatistics.h" -#endif - //----------------------------------------------------------------------------- static NS_DEFINE_CID(kMultiplexInputStream, NS_MULTIPLEXINPUTSTREAM_CID); @@ -266,15 +262,6 @@ nsHttpTransaction::Init(uint32_t caps, NS_GetAppInfo(channel, &mAppId, &mIsInIsolatedMozBrowser); } -#ifdef MOZ_WIDGET_GONK - if (mAppId != NECKO_NO_APP_ID) { - nsCOMPtr<nsINetworkInfo> activeNetworkInfo; - GetActiveNetworkInfo(activeNetworkInfo); - mActiveNetworkInfo = - new nsMainThreadPtrHolder<nsINetworkInfo>(activeNetworkInfo); - } -#endif - nsCOMPtr<nsIHttpChannelInternal> httpChannelInternal = do_QueryInterface(eventsink); if (httpChannelInternal) { @@ -937,40 +924,7 @@ nsHttpTransaction::WriteSegments(nsAHttpSegmentWriter *writer, nsresult nsHttpTransaction::SaveNetworkStats(bool enforce) { -#ifdef MOZ_WIDGET_GONK - // Check if active network and appid are valid. - if (!mActiveNetworkInfo || mAppId == NECKO_NO_APP_ID) { - return NS_OK; - } - - if (mCountRecv <= 0 && mCountSent <= 0) { - // There is no traffic, no need to save. - return NS_OK; - } - - // If |enforce| is false, the traffic amount is saved - // only when the total amount exceeds the predefined - // threshold. - uint64_t totalBytes = mCountRecv + mCountSent; - if (!enforce && totalBytes < NETWORK_STATS_THRESHOLD) { - return NS_OK; - } - - // Create the event to save the network statistics. - // the event is then dispatched to the main thread. - RefPtr<Runnable> event = - new SaveNetworkStatsEvent(mAppId, mIsInIsolatedMozBrowser, mActiveNetworkInfo, - mCountRecv, mCountSent, false); - NS_DispatchToMainThread(event); - - // Reset the counters after saving. - mCountSent = 0; - mCountRecv = 0; - - return NS_OK; -#else return NS_ERROR_NOT_IMPLEMENTED; -#endif } void diff --git a/netwerk/protocol/http/nsHttpTransaction.h b/netwerk/protocol/http/nsHttpTransaction.h index 5bf97d41e..262796d71 100644 --- a/netwerk/protocol/http/nsHttpTransaction.h +++ b/netwerk/protocol/http/nsHttpTransaction.h @@ -19,11 +19,6 @@ #include "ARefBase.h" #include "AlternateServices.h" -#ifdef MOZ_WIDGET_GONK -#include "nsINetworkInterface.h" -#include "nsProxyRelease.h" -#endif - //----------------------------------------------------------------------------- class nsIHttpActivityObserver; @@ -435,9 +430,6 @@ private: uint64_t mCountSent; uint32_t mAppId; bool mIsInIsolatedMozBrowser; -#ifdef MOZ_WIDGET_GONK - nsMainThreadPtrHandle<nsINetworkInfo> mActiveNetworkInfo; -#endif nsresult SaveNetworkStats(bool); void CountRecvBytes(uint64_t recvBytes) { diff --git a/netwerk/protocol/http/nsIHttpProtocolHandler.idl b/netwerk/protocol/http/nsIHttpProtocolHandler.idl index f333a557c..82ac83fe4 100644 --- a/netwerk/protocol/http/nsIHttpProtocolHandler.idl +++ b/netwerk/protocol/http/nsIHttpProtocolHandler.idl @@ -113,14 +113,5 @@ interface nsIHttpProtocolHandler : nsIProxiedProtocolHandler */ #define NS_HTTP_ON_EXAMINE_CACHED_RESPONSE_TOPIC "http-on-examine-cached-response" -/** - * Before an HTTP request corresponding to a channel with the LOAD_DOCUMENT_URI - * flag is sent to the server, this observer topic is notified. The observer of - * this topic can then choose to modify the user agent for this request before - * the request is actually sent to the server. Additionally, the modified user - * agent will be propagated to sub-resource requests from the same load group. - */ -#define NS_HTTP_ON_USERAGENT_REQUEST_TOPIC "http-on-useragent-request" - %} diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp index a6254a088..c6dc8d328 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp @@ -65,10 +65,6 @@ #include "zlib.h" #include <algorithm> -#ifdef MOZ_WIDGET_GONK -#include "NetStatistics.h" -#endif - // rather than slurp up all of nsIWebSocket.idl, which lives outside necko, just // dupe one constant we need from it #define CLOSE_GOING_AWAY 1001 @@ -1396,15 +1392,6 @@ WebSocketChannel::BeginOpenInternal() NS_GetAppInfo(localChannel, &mAppId, &mIsInIsolatedMozBrowser); } -#ifdef MOZ_WIDGET_GONK - if (mAppId != NECKO_NO_APP_ID) { - nsCOMPtr<nsINetworkInfo> activeNetworkInfo; - GetActiveNetworkInfo(activeNetworkInfo); - mActiveNetworkInfo = - new nsMainThreadPtrHolder<nsINetworkInfo>(activeNetworkInfo); - } -#endif - rv = NS_MaybeOpenChannelUsingAsyncOpen2(localChannel, this); if (NS_FAILED(rv)) { @@ -4063,42 +4050,7 @@ WebSocketChannel::OnDataAvailable(nsIRequest *aRequest, nsresult WebSocketChannel::SaveNetworkStats(bool enforce) { -#ifdef MOZ_WIDGET_GONK - // Check if the active network and app id are valid. - if(!mActiveNetworkInfo || mAppId == NECKO_NO_APP_ID) { - return NS_OK; - } - - uint64_t countRecv = 0; - uint64_t countSent = 0; - - mCountRecv.exchange(countRecv); - mCountSent.exchange(countSent); - - if (countRecv == 0 && countSent == 0) { - // There is no traffic, no need to save. - return NS_OK; - } - - // If |enforce| is false, the traffic amount is saved - // only when the total amount exceeds the predefined - // threshold. - uint64_t totalBytes = countRecv + countSent; - if (!enforce && totalBytes < NETWORK_STATS_THRESHOLD) { - return NS_OK; - } - - // Create the event to save the network statistics. - // the event is then dispatched to the main thread. - RefPtr<Runnable> event = - new SaveNetworkStatsEvent(mAppId, mIsInIsolatedMozBrowser, mActiveNetworkInfo, - countRecv, countSent, false); - NS_DispatchToMainThread(event); - - return NS_OK; -#else return NS_ERROR_NOT_IMPLEMENTED; -#endif } } // namespace net diff --git a/netwerk/protocol/websocket/WebSocketChannel.h b/netwerk/protocol/websocket/WebSocketChannel.h index e2f332dab..341a357a0 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.h +++ b/netwerk/protocol/websocket/WebSocketChannel.h @@ -21,11 +21,6 @@ #include "nsIStringStream.h" #include "BaseWebSocketChannel.h" -#ifdef MOZ_WIDGET_GONK -#include "nsINetworkInterface.h" -#include "nsProxyRelease.h" -#endif - #include "nsCOMPtr.h" #include "nsString.h" #include "nsDeque.h" @@ -307,9 +302,6 @@ private: Atomic<uint64_t, Relaxed> mCountSent; uint32_t mAppId; bool mIsInIsolatedMozBrowser; -#ifdef MOZ_WIDGET_GONK - nsMainThreadPtrHandle<nsINetworkInfo> mActiveNetworkInfo; -#endif nsresult SaveNetworkStats(bool); void CountRecvBytes(uint64_t recvBytes) { diff --git a/netwerk/standalone/moz.build b/netwerk/standalone/moz.build index d06711533..b5651da76 100644 --- a/netwerk/standalone/moz.build +++ b/netwerk/standalone/moz.build @@ -4,7 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk': +if CONFIG['OS_TARGET'] != 'WINNT': Library('necko_standalone') src_list = [ diff --git a/netwerk/system/linux/nsNotifyAddrListener_Linux.cpp b/netwerk/system/linux/nsNotifyAddrListener_Linux.cpp index c0ec9d90e..4fc36928a 100644 --- a/netwerk/system/linux/nsNotifyAddrListener_Linux.cpp +++ b/netwerk/system/linux/nsNotifyAddrListener_Linux.cpp @@ -8,10 +8,8 @@ #include <fcntl.h> #include <poll.h> #include <errno.h> -#ifndef MOZ_WIDGET_GONK #include <ifaddrs.h> #include <net/if.h> -#endif #include "nsThreadUtils.h" #include "nsIObserverService.h" @@ -28,10 +26,6 @@ #include "mozilla/Sprintf.h" #include "mozilla/Telemetry.h" -#ifdef MOZ_WIDGET_GONK -#include <cutils/properties.h> -#endif - /* a shorter name that better explains what it does */ #define EINTR_RETRY(x) MOZ_TEMP_FAILURE_RETRY(x) @@ -210,9 +204,6 @@ void nsNotifyAddrListener::calculateNetworkId(void) // void nsNotifyAddrListener::checkLink(void) { -#ifdef MOZ_WIDGET_GONK - // b2g instead has NetworkManager.js which handles UP/DOWN -#else struct ifaddrs *list; struct ifaddrs *ifa; bool link = false; @@ -247,7 +238,6 @@ void nsNotifyAddrListener::checkLink(void) SendEvent(mLinkUp ? NS_NETWORK_LINK_DATA_UP : NS_NETWORK_LINK_DATA_DOWN); } -#endif } void nsNotifyAddrListener::OnNetlinkMessage(int aNetlinkSocket) diff --git a/netwerk/wifi/moz.build b/netwerk/wifi/moz.build index e3edb0842..28149cb78 100644 --- a/netwerk/wifi/moz.build +++ b/netwerk/wifi/moz.build @@ -16,14 +16,9 @@ UNIFIED_SOURCES += [ 'nsWifiAccessPoint.cpp', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - UNIFIED_SOURCES += [ - 'nsWifiMonitorGonk.cpp', - ] -else: - UNIFIED_SOURCES += [ - 'nsWifiMonitor.cpp', - ] +UNIFIED_SOURCES += [ + 'nsWifiMonitor.cpp', +] if CONFIG['OS_ARCH'] == 'Darwin': UNIFIED_SOURCES += [ diff --git a/netwerk/wifi/nsWifiMonitor.h b/netwerk/wifi/nsWifiMonitor.h index 665798efc..c44f6804b 100644 --- a/netwerk/wifi/nsWifiMonitor.h +++ b/netwerk/wifi/nsWifiMonitor.h @@ -48,7 +48,6 @@ class nsWifiListener bool mHasSentData; }; -#ifndef MOZ_WIDGET_GONK class nsWifiMonitor final : nsIRunnable, nsIWifiMonitor, nsIObserver { public: @@ -79,32 +78,5 @@ class nsWifiMonitor final : nsIRunnable, nsIWifiMonitor, nsIObserver nsAutoPtr<WinWifiScanner> mWinWifiScanner; #endif }; -#else -#include "nsIWifi.h" -class nsWifiMonitor final : nsIWifiMonitor, nsIWifiScanResultsReady, nsIObserver -{ - public: - NS_DECL_ISUPPORTS - NS_DECL_NSIWIFIMONITOR - NS_DECL_NSIOBSERVER - NS_DECL_NSIWIFISCANRESULTSREADY - nsWifiMonitor(); - - private: - ~nsWifiMonitor(); - - void ClearTimer() { - if (mTimer) { - mTimer->Cancel(); - mTimer = nullptr; - } - } - void StartScan(); - nsCOMArray<nsWifiAccessPoint> mLastAccessPoints; - nsTArray<nsWifiListener> mListeners; - nsCOMPtr<nsITimer> mTimer; -}; -#endif - -#endif +#endif // __nsWifiMonitor__ diff --git a/netwerk/wifi/nsWifiMonitorGonk.cpp b/netwerk/wifi/nsWifiMonitorGonk.cpp deleted file mode 100644 index 017750549..000000000 --- a/netwerk/wifi/nsWifiMonitorGonk.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsCOMPtr.h" -#include "nsComponentManagerUtils.h" -#include "nsServiceManagerUtils.h" -#include "nsThreadUtils.h" -#include "nsXPCOM.h" -#include "nsXPCOMCID.h" -#include "nsIObserver.h" -#include "nsIObserverService.h" -#include "nsWifiMonitor.h" -#include "nsWifiAccessPoint.h" - -#include "nsServiceManagerUtils.h" -#include "nsComponentManagerUtils.h" -#include "mozilla/Services.h" - -#include "nsIInterfaceRequestor.h" -#include "nsIInterfaceRequestorUtils.h" - -using namespace mozilla; - -LazyLogModule gWifiMonitorLog("WifiMonitor"); - -NS_IMPL_ISUPPORTS(nsWifiMonitor, - nsIWifiMonitor, - nsIObserver, - nsIWifiScanResultsReady) - -nsWifiMonitor::nsWifiMonitor() -{ - nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService(); - if (obsSvc) { - obsSvc->AddObserver(this, "xpcom-shutdown", false); - } - LOG(("@@@@@ wifimonitor created\n")); -} - -nsWifiMonitor::~nsWifiMonitor() -{ -} - -NS_IMETHODIMP -nsWifiMonitor::StartWatching(nsIWifiListener *aListener) -{ - LOG(("@@@@@ nsWifiMonitor::StartWatching\n")); - NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - if (!aListener) { - return NS_ERROR_NULL_POINTER; - } - - mListeners.AppendElement(nsWifiListener(new nsMainThreadPtrHolder<nsIWifiListener>(aListener))); - - if (!mTimer) { - mTimer = do_CreateInstance("@mozilla.org/timer;1"); - mTimer->Init(this, 5000, nsITimer::TYPE_REPEATING_SLACK); - } - StartScan(); - return NS_OK; -} - -NS_IMETHODIMP -nsWifiMonitor::StopWatching(nsIWifiListener *aListener) -{ - LOG(("@@@@@ nsWifiMonitor::StopWatching\n")); - NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - if (!aListener) { - return NS_ERROR_NULL_POINTER; - } - - for (uint32_t i = 0; i < mListeners.Length(); i++) { - if (mListeners[i].mListener == aListener) { - mListeners.RemoveElementAt(i); - break; - } - } - - if (mListeners.Length() == 0) { - ClearTimer(); - } - return NS_OK; -} - -void -nsWifiMonitor::StartScan() -{ - nsCOMPtr<nsIInterfaceRequestor> ir = do_GetService("@mozilla.org/telephony/system-worker-manager;1"); - nsCOMPtr<nsIWifi> wifi = do_GetInterface(ir); - if (!wifi) { - return; - } - wifi->GetWifiScanResults(this); -} - -NS_IMETHODIMP -nsWifiMonitor::Observe(nsISupports *subject, const char *topic, - const char16_t *data) -{ - if (!strcmp(topic, "timer-callback")) { - LOG(("timer callback\n")); - StartScan(); - return NS_OK; - } - - if (!strcmp(topic, "xpcom-shutdown")) { - LOG(("Shutting down\n")); - ClearTimer(); - return NS_OK; - } - - return NS_ERROR_UNEXPECTED; -} - -NS_IMETHODIMP -nsWifiMonitor::Onready(uint32_t count, nsIWifiScanResult **results) -{ - NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - LOG(("@@@@@ About to send data to the wifi listeners\n")); - - nsCOMArray<nsWifiAccessPoint> accessPoints; - - for (uint32_t i = 0; i < count; i++) { - RefPtr<nsWifiAccessPoint> ap = new nsWifiAccessPoint(); - - nsString temp; - results[i]->GetBssid(temp); - // 00:00:00:00:00:00 --> 00-00-00-00-00-00 - for (int32_t x=0; x<6; x++) { - temp.ReplaceSubstring(NS_LITERAL_STRING(":"), NS_LITERAL_STRING("-")); // would it be too much to ask for a ReplaceAll()? - } - - nsCString mac; - mac.AssignWithConversion(temp); - - results[i]->GetSsid(temp); - - nsCString ssid; - ssid.AssignWithConversion(temp); - - uint32_t signal; - results[i]->GetSignalStrength(&signal); - - ap->setSignal(signal); - ap->setMacRaw(mac.get()); - ap->setSSIDRaw(ssid.get(), ssid.Length()); - - accessPoints.AppendObject(ap); - } - - bool accessPointsChanged = !AccessPointsEqual(accessPoints, mLastAccessPoints); - ReplaceArray(mLastAccessPoints, accessPoints); - - nsTArray<nsIWifiAccessPoint*> ac; - uint32_t resultCount = mLastAccessPoints.Count(); - for (uint32_t i = 0; i < resultCount; i++) { - ac.AppendElement(mLastAccessPoints[i]); - } - - for (uint32_t i = 0; i < mListeners.Length(); i++) { - if (!mListeners[i].mHasSentData || accessPointsChanged) { - mListeners[i].mHasSentData = true; - mListeners[i].mListener->OnChange(ac.Elements(), ac.Length()); - } - } - return NS_OK; -} - -NS_IMETHODIMP -nsWifiMonitor::Onfailure() -{ - NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - LOG(("@@@@@ About to send error to the wifi listeners\n")); - for (uint32_t i = 0; i < mListeners.Length(); i++) { - mListeners[i].mListener->OnError(NS_ERROR_UNEXPECTED); - } - - ClearTimer(); - return NS_OK; -} |