mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-26 02:17:34 +09:00
parent
b586913598
commit
2531de02eb
85 changed files with 68 additions and 1357 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue