Remove MOZ_WIDGET_GONK [2/2]

Tag #288
This commit is contained in:
wolfbeast 2018-05-13 00:08:52 +02:00 • committed by Roy Tam
commit 2531de02eb
85 changed files with 68 additions and 1357 deletions

View file

@ -46,7 +46,7 @@
#include "NativeFileWatcherNotSupported.h"
#endif // (XP_WIN)
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
#define MOZ_HAS_TERMINATOR
#endif

View file

@ -145,9 +145,6 @@ static const mozilla::Module::ContractIDEntry kDiskSpaceWatcherContracts[] = {
};
static const mozilla::Module::CategoryEntry kDiskSpaceWatcherCategories[] = {
#ifdef MOZ_WIDGET_GONK
{ "profile-after-change", "Disk Space Watcher Service", DISKSPACEWATCHER_CONTRACTID },
#endif
{ nullptr }
};

View file

@ -410,8 +410,6 @@ this.DownloadIntegration = {
directoryPath = yield this.getPreferredDownloadsDirectory();
#elifdef MOZ_WIDGET_ANDROID
directoryPath = yield this.getSystemDownloadsDirectory();
#elifdef MOZ_WIDGET_GONK
directoryPath = yield this.getSystemDownloadsDirectory();
#else
directoryPath = this._getDirectory("TmpD");
#endif

View file

@ -102,7 +102,7 @@ nsresult DownloadPlatform::DownloadDone(nsIURI* aSource, nsIURI* aReferrer, nsIF
const nsACString& aContentType, bool aIsPrivate)
{
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_ANDROID) \
|| defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GONK)
|| defined(MOZ_WIDGET_GTK)
nsAutoString path;
if (aTarget && NS_SUCCEEDED(aTarget->GetPath(path))) {

View file

@ -237,7 +237,7 @@ NS_IMPL_ISUPPORTS(nsAppStartup,
NS_IMETHODIMP
nsAppStartup::CreateHiddenWindow()
{
#if defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_UIKIT)
#if defined(MOZ_WIDGET_UIKIT)
return NS_OK;
#else
nsCOMPtr<nsIAppShellService> appShellService
@ -252,7 +252,7 @@ nsAppStartup::CreateHiddenWindow()
NS_IMETHODIMP
nsAppStartup::DestroyHiddenWindow()
{
#if defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_UIKIT)
#if defined(MOZ_WIDGET_UIKIT)
return NS_OK;
#else
nsCOMPtr<nsIAppShellService> appShellService

View file

@ -1127,7 +1127,7 @@ TelemetryImpl::SnapshotSubsessionHistograms(bool clearSubsession,
JSContext *cx,
JS::MutableHandle<JS::Value> ret)
{
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
return TelemetryHistogram::CreateHistogramSnapshots(cx, ret, true,
clearSubsession);
#else

View file

@ -583,7 +583,7 @@ internal_GetHistogramByName(const nsACString &name, Histogram **ret)
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
/**
* This clones a histogram |existing| with the id |existingId| to a
@ -684,7 +684,7 @@ internal_HistogramAdd(Histogram& histogram, int32_t value, uint32_t dataset)
return NS_OK;
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
if (Histogram* subsession = internal_GetSubsessionHistogram(histogram)) {
subsession->Add(value);
}
@ -729,7 +729,7 @@ internal_HistogramClear(Histogram& aHistogram, bool onlySubsession)
aHistogram.Clear();
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
if (Histogram* subsession = internal_GetSubsessionHistogram(aHistogram)) {
subsession->Clear();
}
@ -926,7 +926,7 @@ private:
typedef nsBaseHashtableET<nsCStringHashKey, Histogram*> KeyedHistogramEntry;
typedef AutoHashtable<KeyedHistogramEntry> KeyedHistogramMapType;
KeyedHistogramMapType mHistogramMap;
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
KeyedHistogramMapType mSubsessionMap;
#endif
@ -950,7 +950,7 @@ KeyedHistogram::KeyedHistogram(const nsACString &name,
uint32_t min, uint32_t max,
uint32_t bucketCount, uint32_t dataset)
: mHistogramMap()
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
, mSubsessionMap()
#endif
, mName(name)
@ -968,7 +968,7 @@ nsresult
KeyedHistogram::GetHistogram(const nsCString& key, Histogram** histogram,
bool subsession)
{
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
KeyedHistogramMapType& map = subsession ? mSubsessionMap : mHistogramMap;
#else
KeyedHistogramMapType& map = mHistogramMap;
@ -980,7 +980,7 @@ KeyedHistogram::GetHistogram(const nsCString& key, Histogram** histogram,
}
nsCString histogramName;
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
if (subsession) {
histogramName.AppendLiteral(SUBSESSION_HISTOGRAM_PREFIX);
}
@ -1042,7 +1042,7 @@ KeyedHistogram::Add(const nsCString& key, uint32_t sample)
if (!histogram) {
return NS_ERROR_FAILURE;
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
Histogram* subsession = GetHistogram(key, true);
MOZ_ASSERT(subsession);
if (!subsession) {
@ -1055,7 +1055,7 @@ KeyedHistogram::Add(const nsCString& key, uint32_t sample)
}
histogram->Add(sample);
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
subsession->Add(sample);
#endif
return NS_OK;
@ -1068,7 +1068,7 @@ KeyedHistogram::Clear(bool onlySubsession)
if (!XRE_IsParentProcess()) {
return;
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
for (auto iter = mSubsessionMap.Iter(); !iter.Done(); iter.Next()) {
iter.Get()->mData->Clear();
}
@ -1137,7 +1137,7 @@ nsresult
KeyedHistogram::GetJSSnapshot(JSContext* cx, JS::Handle<JSObject*> obj,
bool subsession, bool clearSubsession)
{
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
KeyedHistogramMapType& map = subsession ? mSubsessionMap : mHistogramMap;
#else
KeyedHistogramMapType& map = mHistogramMap;
@ -1146,7 +1146,7 @@ KeyedHistogram::GetJSSnapshot(JSContext* cx, JS::Handle<JSObject*> obj,
return NS_ERROR_FAILURE;
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
if (subsession && clearSubsession) {
Clear(true);
}
@ -1637,7 +1637,7 @@ internal_JSHistogram_Clear(JSContext *cx, unsigned argc, JS::Value *vp)
}
bool onlySubsession = false;
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (args.length() >= 1) {
@ -1874,7 +1874,7 @@ internal_JSKeyedHistogram_Snapshot(JSContext *cx, unsigned argc, JS::Value *vp)
return internal_KeyedHistogram_SnapshotImpl(cx, argc, vp, false, false);
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
bool
internal_JSKeyedHistogram_SubsessionSnapshot(JSContext *cx,
unsigned argc, JS::Value *vp)
@ -1883,7 +1883,7 @@ internal_JSKeyedHistogram_SubsessionSnapshot(JSContext *cx,
}
#endif
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
bool
internal_JSKeyedHistogram_SnapshotSubsessionAndClear(JSContext *cx,
unsigned argc,
@ -1911,7 +1911,7 @@ internal_JSKeyedHistogram_Clear(JSContext *cx, unsigned argc, JS::Value *vp)
return false;
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
bool onlySubsession = false;
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -1974,7 +1974,7 @@ internal_WrapAndReturnKeyedHistogram(KeyedHistogram *h, JSContext *cx,
if (!(JS_DefineFunction(cx, obj, "add", internal_JSKeyedHistogram_Add, 2, 0)
&& JS_DefineFunction(cx, obj, "snapshot",
internal_JSKeyedHistogram_Snapshot, 1, 0)
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
&& JS_DefineFunction(cx, obj, "subsessionSnapshot",
internal_JSKeyedHistogram_SubsessionSnapshot, 1, 0)
&& JS_DefineFunction(cx, obj, "snapshotSubsessionAndClear",
@ -2425,7 +2425,7 @@ TelemetryHistogram::CreateHistogramSnapshots(JSContext *cx,
}
Histogram* original = h;
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
if (subsession) {
h = internal_GetSubsessionHistogram(*h);
if (!h) {
@ -2453,7 +2453,7 @@ TelemetryHistogram::CreateHistogramSnapshots(JSContext *cx,
}
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
if (subsession && clearSubsession) {
h->Clear();
}

View file

@ -1527,11 +1527,9 @@ nsresult SetExceptionHandler(nsIFile* aXREDirectory,
if (gExceptionHandler)
return NS_ERROR_ALREADY_INITIALIZED;
#if !defined(DEBUG) || defined(MOZ_WIDGET_GONK)
#if !defined(DEBUG)
// In non-debug builds, enable the crash reporter by default, and allow
// disabling it with the MOZ_CRASHREPORTER_DISABLE environment variable.
// Also enable it by default in debug gonk builds as it is difficult to
// set environment on startup.
const char *envvar = PR_GetEnv("MOZ_CRASHREPORTER_DISABLE");
if (envvar && *envvar && !force)
return NS_OK;
@ -1543,10 +1541,7 @@ nsresult SetExceptionHandler(nsIFile* aXREDirectory,
return NS_OK;
#endif
#if defined(MOZ_WIDGET_GONK)
doReport = false;
headlessClient = true;
#elif defined(XP_WIN)
#if defined(XP_WIN)
doReport = ShouldReport();
#else
// this environment variable prevents us from launching

View file

@ -148,8 +148,6 @@ this.AppConstants = Object.freeze({
"macosx",
#elif MOZ_WIDGET_ANDROID
"android",
#elif MOZ_WIDGET_GONK
"gonk",
#elif XP_LINUX
"linux",
#else

View file

@ -1,7 +1,6 @@
component {66354bc9-7ed1-4692-ae1d-8da97d6b205e} nsBlocklistService.js
contract @mozilla.org/extensions/blocklist;1 {66354bc9-7ed1-4692-ae1d-8da97d6b205e}
category profile-after-change nsBlocklistService @mozilla.org/extensions/blocklist;1
#ifndef MOZ_WIDGET_GONK
category update-timer nsBlocklistService @mozilla.org/extensions/blocklist;1,getService,blocklist-background-update-timer,extensions.blocklist.interval,86400
component {4399533d-08d1-458c-a87a-235f74451cfa} addonManager.js
contract @mozilla.org/addons/integration;1 {4399533d-08d1-458c-a87a-235f74451cfa}
@ -17,4 +16,3 @@ category JavaScript-global-property InstallTrigger @mozilla.org/addons/installtr
category addon-provider-module PluginProvider resource://gre/modules/addons/PluginProvider.jsm
#endif
category addon-provider-module GMPProvider resource://gre/modules/addons/GMPProvider.jsm
#endif

View file

@ -110,33 +110,10 @@ struct UpdateServerThreadArgs
#define USE_EXECV
#endif
#if defined(MOZ_WIDGET_GONK)
# include "automounter_gonk.h"
# include <unistd.h>
# include <android/log.h>
# include <linux/ioprio.h>
# include <sys/resource.h>
#if ANDROID_VERSION < 21
// The only header file in bionic which has a function prototype for ioprio_set
// is libc/include/sys/linux-unistd.h. However, linux-unistd.h conflicts
// badly with unistd.h, so we declare the prototype for ioprio_set directly.
extern "C" MOZ_EXPORT int ioprio_set(int which, int who, int ioprio);
#else
# include <sys/syscall.h>
static int ioprio_set(int which, int who, int ioprio) {
return syscall(__NR_ioprio_set, which, who, ioprio);
}
#endif
# define MAYBE_USE_HARD_LINKS 1
static bool sUseHardLinks = true;
#else
# define MAYBE_USE_HARD_LINKS 0
#endif
#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && \
!defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
!defined(XP_MACOSX)
#include "nss.h"
#include "prerror.h"
#endif
@ -2495,44 +2472,9 @@ ReadMARChannelIDs(const NS_tchar *path, MARChannelStringTable *results)
static int
GetUpdateFileName(NS_tchar *fileName, int maxChars)
{
#if defined(MOZ_WIDGET_GONK)
// If an update.link file exists, then it will contain the name
// of the update file (terminated by a newline).
NS_tchar linkFileName[MAXPATHLEN];
NS_tsnprintf(linkFileName, sizeof(linkFileName)/sizeof(linkFileName[0]),
NS_T("%s/update.link"), gPatchDirPath);
AutoFile linkFile(NS_tfopen(linkFileName, NS_T("rb")));
if (linkFile == nullptr) {
NS_tsnprintf(fileName, maxChars,
NS_T("%s/update.mar"), gPatchDirPath);
return OK;
}
char dataFileName[MAXPATHLEN];
size_t bytesRead;
if ((bytesRead = fread(dataFileName, 1, sizeof(dataFileName)-1, linkFile)) <= 0) {
*fileName = NS_T('\0');
return READ_ERROR;
}
if (dataFileName[bytesRead-1] == '\n') {
// Strip trailing newline (for \n and \r\n)
bytesRead--;
}
if (dataFileName[bytesRead-1] == '\r') {
// Strip trailing CR (for \r, \r\n)
bytesRead--;
}
dataFileName[bytesRead] = '\0';
strncpy(fileName, dataFileName, maxChars-1);
fileName[maxChars-1] = '\0';
#else
// We currently only support update.link files under GONK
// We currently don't support update.link files
NS_tsnprintf(fileName, maxChars,
NS_T("%s/update.mar"), gPatchDirPath);
#endif
return OK;
}
@ -2776,26 +2718,8 @@ int NS_main(int argc, NS_tchar **argv)
}
#endif
#if defined(MOZ_WIDGET_GONK)
if (EnvHasValue("LD_PRELOAD")) {
// If the updater is launched with LD_PRELOAD set, then we wind up
// preloading libmozglue.so. Under some circumstances, this can cause
// the remount of /system to fail when going from rw to ro, so if we
// detect LD_PRELOAD we unsetenv it and relaunch ourselves without it.
// This will cause the offending preloaded library to be closed.
//
// For a variety of reasons, this is really hard to do in a safe manner
// in the parent process, so we do it here.
unsetenv("LD_PRELOAD");
execv(argv[0], argv);
__android_log_print(ANDROID_LOG_INFO, "updater",
"execve failed: errno: %d. Exiting...", errno);
_exit(1);
}
#endif
#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && \
!defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
!defined(XP_MACOSX)
// On Windows and Mac we rely on native APIs to do verifications so we don't
// need to initialize NSS at all there.
// Otherwise, minimize the amount of NSS we depend on by avoiding all the NSS
@ -3085,36 +3009,6 @@ int NS_main(int argc, NS_tchar **argv)
}
#endif
#ifdef MOZ_WIDGET_GONK
const char *prioEnv = getenv("MOZ_UPDATER_PRIO");
if (prioEnv) {
int32_t prioVal;
int32_t oomScoreAdj;
int32_t ioprioClass;
int32_t ioprioLevel;
if (sscanf(prioEnv, "%d/%d/%d/%d",
&prioVal, &oomScoreAdj, &ioprioClass, &ioprioLevel) == 4) {
LOG(("MOZ_UPDATER_PRIO=%s", prioEnv));
if (setpriority(PRIO_PROCESS, 0, prioVal)) {
LOG(("setpriority(%d) failed, errno = %d", prioVal, errno));
}
if (ioprio_set(IOPRIO_WHO_PROCESS, 0,
IOPRIO_PRIO_VALUE(ioprioClass, ioprioLevel))) {
LOG(("ioprio_set(%d,%d) failed: errno = %d",
ioprioClass, ioprioLevel, errno));
}
FILE *fs = fopen("/proc/self/oom_score_adj", "w");
if (fs) {
fprintf(fs, "%d", oomScoreAdj);
fclose(fs);
} else {
LOG(("Unable to open /proc/self/oom_score_adj for writing, errno = %d",
errno));
}
}
}
#endif
#ifdef XP_WIN
if (pid > 0) {
HANDLE parent = OpenProcess(SYNCHRONIZE, false, (DWORD) pid);
@ -3439,27 +3333,6 @@ int NS_main(int argc, NS_tchar **argv)
}
#endif
#if defined(MOZ_WIDGET_GONK)
// In gonk, the master b2g process sets its umask to 0027 because
// there's no reason for it to ever create world-readable files.
// The updater binary, however, needs to do this, and it inherits
// the master process's cautious umask. So we drop down a bit here.
umask(0022);
// Remount the /system partition as read-write for gonk. The destructor will
// remount /system as read-only. We add an extra level of scope here to avoid
// calling LogFinish() before the GonkAutoMounter destructor has a chance
// to be called
{
#if !defined(TEST_UPDATER)
GonkAutoMounter mounter;
if (mounter.GetAccess() != MountAccess::ReadWrite) {
WriteStatusFile(FILESYSTEM_MOUNT_READWRITE_ERROR);
return 1;
}
#endif
#endif
if (sStagedUpdate) {
// When staging updates, blow away the old installation directory and create
// it from scratch.
@ -3759,10 +3632,6 @@ int NS_main(int argc, NS_tchar **argv)
}
#endif /* XP_WIN */
#if defined(MOZ_WIDGET_GONK)
} // end the extra level of scope for the GonkAutoMounter
#endif
#ifdef XP_MACOSX
// When the update is successful remove the precomplete file in the root of
// the application bundle and move the distribution directory from

View file

@ -5,7 +5,6 @@ component {e0a106ed-6ad4-47a4-b6af-2f1c8aa4712d} nsBlocklistServiceContent.js pr
contract @mozilla.org/extensions/blocklist;1 {e0a106ed-6ad4-47a4-b6af-2f1c8aa4712d} process=content
category update-timer nsBlocklistService @mozilla.org/extensions/blocklist;1,getService,blocklist-background-update-timer,extensions.blocklist.interval,86400
#ifndef MOZ_WIDGET_GONK
component {4399533d-08d1-458c-a87a-235f74451cfa} addonManager.js
contract @mozilla.org/addons/integration;1 {4399533d-08d1-458c-a87a-235f74451cfa}
#ifndef MOZ_WIDGET_ANDROID
@ -22,6 +21,5 @@ category JavaScript-global-property InstallTrigger @mozilla.org/addons/installtr
category addon-provider-module PluginProvider resource://gre/modules/addons/PluginProvider.jsm
#endif
category addon-provider-module GMPProvider resource://gre/modules/addons/GMPProvider.jsm
#endif
component {8866d8e3-4ea5-48b7-a891-13ba0ac15235} amWebAPI.js
contract @mozilla.org/addon-web-api/manager;1 {8866d8e3-4ea5-48b7-a891-13ba0ac15235}

View file

@ -30,10 +30,6 @@
#include "prenv.h"
#endif
#if defined(MOZ_WIDGET_GONK)
#include <sys/syscall.h>
#endif
// **********************************************************************
// class nsProfileLock
//
@ -192,25 +188,6 @@ void nsProfileLock::FatalSignalHandler(int signo
}
}
#ifdef MOZ_WIDGET_GONK
switch (signo) {
case SIGQUIT:
case SIGILL:
case SIGABRT:
case SIGSEGV:
// Retrigger the signal for those that can generate a core dump
signal(signo, SIG_DFL);
if (info->si_code <= 0) {
if (syscall(__NR_tgkill, getpid(), syscall(__NR_gettid), signo) < 0) {
break;
}
}
return;
default:
break;
}
#endif
// Backstop exit call, just in case.
_exit(signo);
}

View file

@ -65,12 +65,6 @@
#include <prthread.h>
#include <prtime.h>
#ifdef MOZ_WIDGET_GONK
#include "nsThreadUtils.h"
#include "nsIObserverService.h"
#include "mozilla/Services.h"
#endif
using mozilla::TimeDuration;
using mozilla::TimeStamp;
using mozilla::FireAndWaitForTracerEvent;
@ -85,31 +79,6 @@ struct TracerStartClosure {
int32_t mThresholdInterval;
};
#ifdef MOZ_WIDGET_GONK
class EventLoopLagDispatcher : public Runnable
{
public:
explicit EventLoopLagDispatcher(int aLag)
: mLag(aLag) {}
NS_IMETHOD Run() override
{
nsCOMPtr<nsIObserverService> obsService =
mozilla::services::GetObserverService();
if (!obsService) {
return NS_ERROR_FAILURE;
}
nsAutoString value;
value.AppendInt(mLag);
return obsService->NotifyObservers(nullptr, "event-loop-lag", value.get());
}
private:
int mLag;
};
#endif
/*
* The tracer thread fires events at the native event loop roughly
* every kMeasureInterval. It will sleep to attempt not to send them
@ -180,10 +149,6 @@ void TracerThread(void *arg)
fprintf(log, "MOZ_EVENT_TRACE sample %llu %lf\n",
now,
duration.ToMilliseconds());
#ifdef MOZ_WIDGET_GONK
NS_DispatchToMainThread(
new EventLoopLagDispatcher(int(duration.ToSecondsSigDigits() * 1000)));
#endif
}
if (next_sleep > duration.ToMilliseconds()) {

View file

@ -275,7 +275,7 @@ XRE_InitChildProcess(int aArgc,
setupProfilingStuff();
#endif
#if !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_GONK)
#if !defined(MOZ_WIDGET_ANDROID)
// On non-Fennec Gecko, the GMPLoader code resides in plugin-container,
// and we must forward it through to the GMP code here.
GMPProcessChild::SetGMPLoader(aChildData->gmpLoader.get());

View file

@ -74,23 +74,6 @@ GetUpdateLog()
#define UPDATER_PNG "updater.png"
#endif
#if defined(MOZ_WIDGET_GONK)
#include <linux/ioprio.h>
static const int kB2GServiceArgc = 2;
static const char *kB2GServiceArgv[] = { "/system/bin/start", "b2g" };
static const char kAppUpdaterPrio[] = "app.update.updater.prio";
static const char kAppUpdaterOomScoreAdj[] = "app.update.updater.oom_score_adj";
static const char kAppUpdaterIOPrioClass[] = "app.update.updater.ioprio.class";
static const char kAppUpdaterIOPrioLevel[] = "app.update.updater.ioprio.level";
static const int kAppUpdaterPrioDefault = 19; // -20..19 where 19 = lowest priority
static const int kAppUpdaterOomScoreAdjDefault = -1000; // -1000 = Never kill
static const int kAppUpdaterIOPrioClassDefault = IOPRIO_CLASS_IDLE;
static const int kAppUpdaterIOPrioLevelDefault = 0; // Doesn't matter for CLASS IDLE
#endif
static nsresult
GetCurrentWorkingDir(char *buf, size_t size)
{
@ -387,7 +370,7 @@ CopyUpdaterIntoUpdateDir(nsIFile *greDir, nsIFile *appDir, nsIFile *updateDir,
* @param pathToAppend A new library path to prepend to LD_LIBRARY_PATH
*/
#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && \
!defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
!defined(XP_MACOSX)
#include "prprf.h"
#define PATH_SEPARATOR ":"
#define LD_LIBRARY_PATH_ENVVAR_NAME "LD_LIBRARY_PATH"
@ -503,15 +486,9 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir,
#else
nsAutoCString appFilePath;
#if defined(MOZ_WIDGET_GONK)
appFilePath.Assign(kB2GServiceArgv[0]);
appArgc = kB2GServiceArgc;
appArgv = const_cast<char**>(kB2GServiceArgv);
#else
rv = appFile->GetNativePath(appFilePath);
if (NS_FAILED(rv))
return;
#endif
nsAutoCString updaterPath;
rv = updater->GetNativePath(updaterPath);
@ -617,19 +594,13 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir,
PR_SetEnv("MOZ_SAFE_MODE_RESTART=1");
}
#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && \
!defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
!defined(XP_MACOSX)
AppendToLibPath(installDirPath.get());
#endif
LOG(("spawning updater process for replacing [%s]\n", updaterPath.get()));
#if defined(XP_UNIX) & !defined(XP_MACOSX)
# if defined(MOZ_WIDGET_GONK)
// In Gonk, we preload libmozglue, which the updater process doesn't need.
// Since the updater will move and delete libmozglue.so, this can actually
// stop the /system mount from correctly being remounted as read-only.
unsetenv("LD_PRELOAD");
# endif
exit(execv(updaterPath.get(), argv));
#elif defined(XP_WIN)
// Switch the application using updater.exe
@ -647,46 +618,6 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir,
#endif
}
#if defined(MOZ_WIDGET_GONK)
static nsresult
GetOSApplyToDir(nsACString& applyToDir)
{
nsCOMPtr<nsIProperties> ds =
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
NS_ASSERTION(ds, "Can't get directory service");
nsCOMPtr<nsIFile> osApplyToDir;
nsresult rv = ds->Get(XRE_OS_UPDATE_APPLY_TO_DIR, NS_GET_IID(nsIFile),
getter_AddRefs(osApplyToDir));
if (NS_FAILED(rv)) {
LOG(("Can't get the OS applyTo dir"));
return rv;
}
return osApplyToDir->GetNativePath(applyToDir);
}
static void
SetOSApplyToDir(nsIUpdate* update, const nsACString& osApplyToDir)
{
nsresult rv;
nsCOMPtr<nsIWritablePropertyBag> updateProperties =
do_QueryInterface(update, &rv);
if (NS_FAILED(rv)) {
return;
}
RefPtr<nsVariant> variant = new nsVariant();
rv = variant->SetAsACString(osApplyToDir);
if (NS_FAILED(rv)) {
return;
}
updateProperties->SetProperty(NS_LITERAL_STRING("osApplyToDir"), variant);
}
#endif
/**
* Apply an update. This applies to both normal and staged updates.
*
@ -780,13 +711,9 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
if (NS_FAILED(rv))
return;
// Get the directory where the update was staged for replace and GONK OS
// Updates or where it will be applied.
#ifndef MOZ_WIDGET_GONK
// OS Updates are only supported on GONK so force it to false on everything
// OS Updates were only supported on GONK so force it to false on everything
// but GONK to simplify the following logic.
isOSUpdate = false;
#endif
nsAutoCString applyToDir;
nsCOMPtr<nsIFile> updatedDir;
if (restart && !isOSUpdate) {
@ -806,15 +733,6 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
return;
}
applyToDir = NS_ConvertUTF16toUTF8(applyToDirW);
#elif MOZ_WIDGET_GONK
if (isOSUpdate) {
if (!osApplyToDir) {
return;
}
rv = osApplyToDir->GetNativePath(applyToDir);
} else {
rv = updatedDir->GetNativePath(applyToDir);
}
#else
rv = updatedDir->GetNativePath(applyToDir);
#endif
@ -900,33 +818,13 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
PR_SetEnv("MOZ_SAFE_MODE_RESTART=1");
}
#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && \
!defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
!defined(XP_MACOSX)
AppendToLibPath(installDirPath.get());
#endif
if (isOSUpdate) {
PR_SetEnv("MOZ_OS_UPDATE=1");
}
#if defined(MOZ_WIDGET_GONK)
// We want the updater to be CPU friendly and not subject to being killed by
// the low memory killer, so we pass in some preferences to allow it to
// adjust its priority.
int32_t prioVal = Preferences::GetInt(kAppUpdaterPrio,
kAppUpdaterPrioDefault);
int32_t oomScoreAdj = Preferences::GetInt(kAppUpdaterOomScoreAdj,
kAppUpdaterOomScoreAdjDefault);
int32_t ioprioClass = Preferences::GetInt(kAppUpdaterIOPrioClass,
kAppUpdaterIOPrioClassDefault);
int32_t ioprioLevel = Preferences::GetInt(kAppUpdaterIOPrioLevel,
kAppUpdaterIOPrioLevelDefault);
nsPrintfCString prioEnv("MOZ_UPDATER_PRIO=%d/%d/%d/%d",
prioVal, oomScoreAdj, ioprioClass, ioprioLevel);
// Note: we allocate a new string on heap and pass that to PR_SetEnv, since
// the string can be used after this function returns. This means that we
// will intentionally leak this buffer.
PR_SetEnv(ToNewCString(prioEnv));
#endif
LOG(("spawning updater process [%s]\n", updaterPath.get()));
@ -1122,12 +1020,6 @@ nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate)
// Check for and process any available updates
bool persistent;
nsresult rv = NS_ERROR_FAILURE; // Take the NS_FAILED path when non-GONK
#ifdef MOZ_WIDGET_GONK
// Check in the sdcard for updates first, since that's our preferred
// download location.
rv = dirProvider->GetFile(XRE_UPDATE_ARCHIVE_DIR, &persistent,
getter_AddRefs(updRoot));
#endif
if (NS_FAILED(rv)) {
rv = dirProvider->GetFile(XRE_UPDATE_ROOT_DIR, &persistent,
getter_AddRefs(updRoot));
@ -1217,34 +1109,6 @@ nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate)
}
mInfo.mAppVersion = appVersion;
#if defined(MOZ_WIDGET_GONK)
NS_ENSURE_ARG_POINTER(aUpdate);
bool isOSUpdate;
if (NS_SUCCEEDED(aUpdate->GetIsOSUpdate(&isOSUpdate)) &&
isOSUpdate) {
nsAutoCString osApplyToDir;
// This needs to be done on the main thread, so we pass it along in
// BackgroundThreadInfo
nsresult rv = GetOSApplyToDir(osApplyToDir);
if (NS_FAILED(rv)) {
LOG(("Can't get the OS apply to dir"));
return rv;
}
SetOSApplyToDir(aUpdate, osApplyToDir);
mInfo.mIsOSUpdate = true;
rv = NS_NewNativeLocalFile(osApplyToDir, false,
getter_AddRefs(mInfo.mOSApplyToDir));
if (NS_FAILED(rv)) {
LOG(("Can't create nsIFile for OS apply to dir"));
return rv;
}
}
#endif
MOZ_ASSERT(NS_IsMainThread(), "not main thread");
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(this, &nsUpdateProcessor::StartStagedUpdate);
return NS_NewThread(getter_AddRefs(mProcessWatcher), r);

View file

@ -1122,14 +1122,6 @@ nsresult
nsXREDirProvider::GetUpdateRootDir(nsIFile* *aResult)
{
nsCOMPtr<nsIFile> updRoot;
#if defined(MOZ_WIDGET_GONK)
nsresult rv = NS_NewNativeLocalFile(nsDependentCString("/data/local"),
true,
getter_AddRefs(updRoot));
NS_ENSURE_SUCCESS(rv, rv);
#else
nsCOMPtr<nsIFile> appFile;
bool per = false;
nsresult rv = GetFile(XRE_EXECUTABLE_FILE, &per, getter_AddRefs(appFile));
@ -1261,7 +1253,6 @@ nsXREDirProvider::GetUpdateRootDir(nsIFile* *aResult)
NS_ENSURE_SUCCESS(rv, rv);
#endif // XP_WIN
#endif
updRoot.forget(aResult);
return NS_OK;
}
@ -1365,9 +1356,6 @@ nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, bool aLocal)
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_NewLocalFile(path, true, getter_AddRefs(localDir));
#elif defined(MOZ_WIDGET_GONK)
rv = NS_NewNativeLocalFile(NS_LITERAL_CSTRING("/data/b2g"), true,
getter_AddRefs(localDir));
#elif defined(XP_UNIX)
const char* homeDir = getenv("HOME");
if (!homeDir || !*homeDir)