mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-31 11:37:30 +09:00
parent
5830ff1f2b
commit
74df182488
232 changed files with 256 additions and 36730 deletions
|
|
@ -90,7 +90,7 @@ function LoginObserver(captivePortalDetector) {
|
|||
.getService(Ci.nsIHttpActivityDistributor);
|
||||
let urlFetcher = null;
|
||||
|
||||
let waitForNetworkActivity = Services.appinfo.widgetToolkit == "gonk";
|
||||
let waitForNetworkActivity = false;
|
||||
|
||||
let pageCheckingDone = function pageCheckingDone() {
|
||||
if (state === LOGIN_OBSERVER_STATE_VERIFYING) {
|
||||
|
|
|
|||
|
|
@ -753,13 +753,13 @@ File.prototype = {
|
|||
};
|
||||
|
||||
|
||||
if (SharedAll.Constants.Sys.Name != "Android" && SharedAll.Constants.Sys.Name != "Gonk") {
|
||||
if (SharedAll.Constants.Sys.Name != "Android") {
|
||||
/**
|
||||
* Set the last access and modification date of the file.
|
||||
* The time stamp resolution is 1 second at best, but might be worse
|
||||
* depending on the platform.
|
||||
*
|
||||
* WARNING: This method is not implemented on Android/B2G. On Android/B2G,
|
||||
* WARNING: This method is not implemented on Android. On Android,
|
||||
* you should use File.setDates instead.
|
||||
*
|
||||
* @return {promise}
|
||||
|
|
|
|||
|
|
@ -15,12 +15,7 @@ add_task(function* check_definition() {
|
|||
do_check_true(OS.Constants.Path!=null);
|
||||
do_check_true(OS.Constants.Sys!=null);
|
||||
//check system name
|
||||
if (OS.Constants.Sys.Name == "Gonk") {
|
||||
// Services.appinfo.OS doesn't know the difference between Gonk and Android
|
||||
do_check_eq(Services.appinfo.OS, "Android");
|
||||
} else {
|
||||
do_check_eq(Services.appinfo.OS, OS.Constants.Sys.Name);
|
||||
}
|
||||
do_check_eq(Services.appinfo.OS, OS.Constants.Sys.Name);
|
||||
|
||||
//check if using DEBUG build
|
||||
if (Components.classes["@mozilla.org/xpcom/debug;1"].getService(Components.interfaces.nsIDebug2).isDebugBuild == true) {
|
||||
|
|
|
|||
|
|
@ -96,8 +96,8 @@ add_task(function* test_nonproto() {
|
|||
|
||||
// Prototypical tests, operating on |File| handles.
|
||||
add_task(function* test_proto() {
|
||||
if (OS.Constants.Sys.Name == "Android" || OS.Constants.Sys.Name == "Gonk") {
|
||||
do_print("File.prototype.setDates is not implemented for Android/B2G");
|
||||
if (OS.Constants.Sys.Name == "Android") {
|
||||
do_print("File.prototype.setDates is not implemented for Android");
|
||||
do_check_eq(OS.File.prototype.setDates, undefined);
|
||||
return;
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ add_task(function* test_proto() {
|
|||
"test_osfile_async_setDates_proto.tmp");
|
||||
yield OS.File.writeAtomic(path, new Uint8Array(1));
|
||||
|
||||
try {
|
||||
try {
|
||||
let fd = yield OS.File.open(path, {write: true});
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ add_task(function* test_simple_paths() {
|
|||
|
||||
// Test presence of paths that only exist on Desktop platforms
|
||||
add_task(function* test_desktop_paths() {
|
||||
if (OS.Constants.Sys.Name == "Android" || OS.Constants.Sys.Name == "Gonk") {
|
||||
if (OS.Constants.Sys.Name == "Android") {
|
||||
return;
|
||||
}
|
||||
do_check_true(!!OS.Constants.Path.desktopDir);
|
||||
|
|
|
|||
|
|
@ -28,11 +28,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "AttributionCode",
|
|||
"resource:///modules/AttributionCode.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ctypes",
|
||||
"resource://gre/modules/ctypes.jsm");
|
||||
if (AppConstants.platform !== "gonk") {
|
||||
Cu.import("resource://gre/modules/AddonManager.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
|
||||
"resource://gre/modules/LightweightThemeManager.jsm");
|
||||
}
|
||||
Cu.import("resource://gre/modules/AddonManager.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
|
||||
"resource://gre/modules/LightweightThemeManager.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ProfileAge",
|
||||
"resource://gre/modules/ProfileAge.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
|
||||
|
|
@ -528,11 +526,9 @@ EnvironmentAddonBuilder.prototype = {
|
|||
_updateAddons: Task.async(function* () {
|
||||
this._environment._log.trace("_updateAddons");
|
||||
let personaId = null;
|
||||
if (AppConstants.platform !== "gonk") {
|
||||
let theme = LightweightThemeManager.currentTheme;
|
||||
if (theme) {
|
||||
personaId = theme.id;
|
||||
}
|
||||
let theme = LightweightThemeManager.currentTheme;
|
||||
if (theme) {
|
||||
personaId = theme.id;
|
||||
}
|
||||
|
||||
let addons = {
|
||||
|
|
@ -745,14 +741,8 @@ function EnvironmentCache() {
|
|||
// until the initial environment has been built.
|
||||
|
||||
let p = [];
|
||||
if (AppConstants.platform === "gonk") {
|
||||
this._addonBuilder = {
|
||||
watchForChanges: function() {}
|
||||
};
|
||||
} else {
|
||||
this._addonBuilder = new EnvironmentAddonBuilder(this);
|
||||
p = [ this._addonBuilder.init() ];
|
||||
}
|
||||
this._addonBuilder = new EnvironmentAddonBuilder(this);
|
||||
p = [ this._addonBuilder.init() ];
|
||||
|
||||
this._currentEnvironment.profile = {};
|
||||
p.push(this._updateProfile());
|
||||
|
|
@ -1079,10 +1069,6 @@ EnvironmentCache.prototype = {
|
|||
* @returns null on error, true if we are the default browser, or false otherwise.
|
||||
*/
|
||||
_isDefaultBrowser: function () {
|
||||
if (AppConstants.platform === "gonk") {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!("@mozilla.org/browser/shell-service;1" in Cc)) {
|
||||
this._log.info("_isDefaultBrowser - Could not obtain browser shell service");
|
||||
return null;
|
||||
|
|
@ -1139,10 +1125,8 @@ EnvironmentCache.prototype = {
|
|||
userPrefs: this._getPrefData(),
|
||||
};
|
||||
|
||||
if (AppConstants.platform !== "gonk") {
|
||||
this._currentEnvironment.settings.addonCompatibilityCheckEnabled =
|
||||
AddonManager.checkCompatibility;
|
||||
}
|
||||
this._currentEnvironment.settings.addonCompatibilityCheckEnabled =
|
||||
AddonManager.checkCompatibility;
|
||||
|
||||
if (AppConstants.platform !== "android") {
|
||||
this._currentEnvironment.settings.isDefaultBrowser =
|
||||
|
|
@ -1246,7 +1230,7 @@ EnvironmentCache.prototype = {
|
|||
* not a portable device.
|
||||
*/
|
||||
_getDeviceData: function () {
|
||||
if (!["gonk", "android"].includes(AppConstants.platform)) {
|
||||
if (!["android"].includes(AppConstants.platform)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -1269,7 +1253,7 @@ EnvironmentCache.prototype = {
|
|||
locale: forceToStringOrNull(getSystemLocale()),
|
||||
};
|
||||
|
||||
if (["gonk", "android"].includes(AppConstants.platform)) {
|
||||
if (["android"].includes(AppConstants.platform)) {
|
||||
data.kernelVersion = forceToStringOrNull(getSysinfoProperty("kernel_version", null));
|
||||
} else if (AppConstants.platform === "win") {
|
||||
// The path to the "UBR" key, queried to get additional version details on Windows.
|
||||
|
|
@ -1333,7 +1317,7 @@ EnvironmentCache.prototype = {
|
|||
features: {},
|
||||
};
|
||||
|
||||
if (!["gonk", "android", "linux"].includes(AppConstants.platform)) {
|
||||
if (!["android", "linux"].includes(AppConstants.platform)) {
|
||||
let gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
|
||||
try {
|
||||
gfxData.monitors = gfxInfo.getMonitors();
|
||||
|
|
@ -1398,7 +1382,7 @@ EnvironmentCache.prototype = {
|
|||
|
||||
if (AppConstants.platform === "win") {
|
||||
data.isWow64 = getSysinfoProperty("isWow64", null);
|
||||
} else if (["gonk", "android"].includes(AppConstants.platform)) {
|
||||
} else if (["android"].includes(AppConstants.platform)) {
|
||||
data.device = this._getDeviceData();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1372,7 +1372,7 @@ var Impl = {
|
|||
|
||||
let payload;
|
||||
try {
|
||||
const isMobile = ["gonk", "android"].includes(AppConstants.platform);
|
||||
const isMobile = ["android"].includes(AppConstants.platform);
|
||||
const isSubsession = isMobile ? false : !this._isClassicReason(reason);
|
||||
|
||||
if (isMobile) {
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ PingParseError.prototype.constructor = PingParseError;
|
|||
var Policy = {
|
||||
now: () => new Date(),
|
||||
getArchiveQuota: () => ARCHIVE_QUOTA_BYTES,
|
||||
getPendingPingsQuota: () => (AppConstants.platform in ["android", "gonk"])
|
||||
getPendingPingsQuota: () => (AppConstants.platform in ["android"])
|
||||
? PENDING_PINGS_QUOTA_BYTES_MOBILE
|
||||
: PENDING_PINGS_QUOTA_BYTES_DESKTOP,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "OS",
|
|||
const gIsWindows = AppConstants.platform == "win";
|
||||
const gIsMac = AppConstants.platform == "macosx";
|
||||
const gIsAndroid = AppConstants.platform == "android";
|
||||
const gIsGonk = AppConstants.platform == "gonk";
|
||||
const gIsGonk = false;
|
||||
const gIsLinux = AppConstants.platform == "linux";
|
||||
|
||||
const Telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,4 @@ elif CONFIG['GNU_CXX']:
|
|||
if CONFIG['CLANG_CXX']:
|
||||
CXXFLAGS += ['-Wno-implicit-fallthrough']
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
||||
DEFINES['ELFSIZE'] = 32
|
||||
|
||||
DEFINES['NO_STABS_SUPPORT'] = True
|
||||
|
|
|
|||
|
|
@ -32,7 +32,4 @@ if CONFIG['OS_TARGET'] == 'Android' and CONFIG['CPU_ARCH'] == 'x86':
|
|||
# The NDK's user.h defines this struct with a different name.
|
||||
DEFINES['user_fpxregs_struct'] = 'user_fxsr_struct'
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
||||
DEFINES['getcontext'] = 'breakpad_getcontext'
|
||||
|
||||
include('/toolkit/crashreporter/crashreporter.mozbuild')
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
[DEFAULT]
|
||||
head = head_identity.js
|
||||
tail = tail_identity.js
|
||||
skip-if = (appname != "b2g" || toolkit == 'gonk')
|
||||
skip-if = true
|
||||
support-files =
|
||||
data/idp_1/.well-known/browserid
|
||||
data/idp_invalid_1/.well-known/browserid
|
||||
|
|
|
|||
|
|
@ -12,116 +12,115 @@ EXTRA_JS_MODULES.sdk.system += [
|
|||
'modules/system/Startup.js',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] != "gonk":
|
||||
EXTRA_JS_MODULES.commonjs.method.test += [
|
||||
'method/test/browser.js',
|
||||
'method/test/common.js',
|
||||
]
|
||||
EXTRA_JS_MODULES.commonjs.method.test += [
|
||||
'method/test/browser.js',
|
||||
'method/test/common.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES.commonjs.sdk.deprecated += [
|
||||
'sdk/deprecated/api-utils.js',
|
||||
'sdk/deprecated/sync-worker.js',
|
||||
'sdk/deprecated/unit-test-finder.js',
|
||||
'sdk/deprecated/unit-test.js',
|
||||
'sdk/deprecated/window-utils.js',
|
||||
]
|
||||
EXTRA_JS_MODULES.commonjs.sdk.deprecated += [
|
||||
'sdk/deprecated/api-utils.js',
|
||||
'sdk/deprecated/sync-worker.js',
|
||||
'sdk/deprecated/unit-test-finder.js',
|
||||
'sdk/deprecated/unit-test.js',
|
||||
'sdk/deprecated/window-utils.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES.commonjs.sdk.frame += [
|
||||
'sdk/frame/hidden-frame.js',
|
||||
'sdk/frame/utils.js',
|
||||
]
|
||||
EXTRA_JS_MODULES.commonjs.sdk.frame += [
|
||||
'sdk/frame/hidden-frame.js',
|
||||
'sdk/frame/utils.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES.commonjs.sdk.panel += [
|
||||
'sdk/panel/events.js',
|
||||
'sdk/panel/utils.js',
|
||||
]
|
||||
EXTRA_JS_MODULES.commonjs.sdk.panel += [
|
||||
'sdk/panel/events.js',
|
||||
'sdk/panel/utils.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES.commonjs.sdk.places += [
|
||||
'sdk/places/bookmarks.js',
|
||||
'sdk/places/contract.js',
|
||||
'sdk/places/events.js',
|
||||
'sdk/places/favicon.js',
|
||||
'sdk/places/history.js',
|
||||
'sdk/places/utils.js',
|
||||
]
|
||||
EXTRA_JS_MODULES.commonjs.sdk.places += [
|
||||
'sdk/places/bookmarks.js',
|
||||
'sdk/places/contract.js',
|
||||
'sdk/places/events.js',
|
||||
'sdk/places/favicon.js',
|
||||
'sdk/places/history.js',
|
||||
'sdk/places/utils.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES.commonjs.sdk.places.host += [
|
||||
'sdk/places/host/host-bookmarks.js',
|
||||
'sdk/places/host/host-query.js',
|
||||
'sdk/places/host/host-tags.js',
|
||||
]
|
||||
EXTRA_JS_MODULES.commonjs.sdk.places.host += [
|
||||
'sdk/places/host/host-bookmarks.js',
|
||||
'sdk/places/host/host-query.js',
|
||||
'sdk/places/host/host-tags.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES.commonjs.sdk.tabs += [
|
||||
'sdk/tabs/common.js',
|
||||
'sdk/tabs/events.js',
|
||||
'sdk/tabs/helpers.js',
|
||||
'sdk/tabs/namespace.js',
|
||||
'sdk/tabs/observer.js',
|
||||
'sdk/tabs/tab-fennec.js',
|
||||
'sdk/tabs/tab-firefox.js',
|
||||
'sdk/tabs/tab.js',
|
||||
'sdk/tabs/tabs-firefox.js',
|
||||
'sdk/tabs/utils.js',
|
||||
'sdk/tabs/worker.js',
|
||||
]
|
||||
EXTRA_JS_MODULES.commonjs.sdk.tabs += [
|
||||
'sdk/tabs/common.js',
|
||||
'sdk/tabs/events.js',
|
||||
'sdk/tabs/helpers.js',
|
||||
'sdk/tabs/namespace.js',
|
||||
'sdk/tabs/observer.js',
|
||||
'sdk/tabs/tab-fennec.js',
|
||||
'sdk/tabs/tab-firefox.js',
|
||||
'sdk/tabs/tab.js',
|
||||
'sdk/tabs/tabs-firefox.js',
|
||||
'sdk/tabs/utils.js',
|
||||
'sdk/tabs/worker.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES.commonjs.sdk.test += [
|
||||
'sdk/test/assert.js',
|
||||
'sdk/test/harness.js',
|
||||
'sdk/test/httpd.js',
|
||||
'sdk/test/loader.js',
|
||||
'sdk/test/memory.js',
|
||||
'sdk/test/options.js',
|
||||
'sdk/test/runner.js',
|
||||
'sdk/test/utils.js',
|
||||
]
|
||||
EXTRA_JS_MODULES.commonjs.sdk.test += [
|
||||
'sdk/test/assert.js',
|
||||
'sdk/test/harness.js',
|
||||
'sdk/test/httpd.js',
|
||||
'sdk/test/loader.js',
|
||||
'sdk/test/memory.js',
|
||||
'sdk/test/options.js',
|
||||
'sdk/test/runner.js',
|
||||
'sdk/test/utils.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES.commonjs.sdk.ui += [
|
||||
'sdk/ui/component.js',
|
||||
'sdk/ui/frame.js',
|
||||
'sdk/ui/id.js',
|
||||
'sdk/ui/sidebar.js',
|
||||
'sdk/ui/state.js',
|
||||
'sdk/ui/toolbar.js',
|
||||
]
|
||||
|
||||
if CONFIG['MC_PALEMOON']:
|
||||
EXTRA_JS_MODULES.commonjs.sdk.ui += [
|
||||
'sdk/ui/component.js',
|
||||
'sdk/ui/frame.js',
|
||||
'sdk/ui/id.js',
|
||||
'sdk/ui/sidebar.js',
|
||||
'sdk/ui/state.js',
|
||||
'sdk/ui/toolbar.js',
|
||||
'sdk/ui/buttons.js',
|
||||
]
|
||||
|
||||
if CONFIG['MC_PALEMOON']:
|
||||
EXTRA_JS_MODULES.commonjs.sdk.ui += [
|
||||
'sdk/ui/buttons.js',
|
||||
]
|
||||
EXTRA_JS_MODULES.commonjs.sdk.ui.button += [
|
||||
'sdk/ui/button/action.js',
|
||||
'sdk/ui/button/contract.js',
|
||||
'sdk/ui/button/toggle.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES.commonjs.sdk.ui.button += [
|
||||
'sdk/ui/button/action.js',
|
||||
'sdk/ui/button/contract.js',
|
||||
'sdk/ui/button/toggle.js',
|
||||
]
|
||||
EXTRA_PP_JS_MODULES.commonjs.sdk.ui.button += [
|
||||
'sdk/ui/button/view.js',
|
||||
]
|
||||
|
||||
EXTRA_PP_JS_MODULES.commonjs.sdk.ui.button += [
|
||||
'sdk/ui/button/view.js',
|
||||
]
|
||||
EXTRA_JS_MODULES.commonjs.sdk.ui.sidebar += [
|
||||
'sdk/ui/sidebar/actions.js',
|
||||
'sdk/ui/sidebar/contract.js',
|
||||
'sdk/ui/sidebar/namespace.js',
|
||||
'sdk/ui/sidebar/utils.js',
|
||||
'sdk/ui/sidebar/view.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES.commonjs.sdk.ui.sidebar += [
|
||||
'sdk/ui/sidebar/actions.js',
|
||||
'sdk/ui/sidebar/contract.js',
|
||||
'sdk/ui/sidebar/namespace.js',
|
||||
'sdk/ui/sidebar/utils.js',
|
||||
'sdk/ui/sidebar/view.js',
|
||||
]
|
||||
EXTRA_JS_MODULES.commonjs.sdk.window += [
|
||||
'sdk/window/browser.js',
|
||||
'sdk/window/events.js',
|
||||
'sdk/window/helpers.js',
|
||||
'sdk/window/namespace.js',
|
||||
'sdk/window/utils.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES.commonjs.sdk.window += [
|
||||
'sdk/window/browser.js',
|
||||
'sdk/window/events.js',
|
||||
'sdk/window/helpers.js',
|
||||
'sdk/window/namespace.js',
|
||||
'sdk/window/utils.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES.commonjs.sdk.windows += [
|
||||
'sdk/windows/fennec.js',
|
||||
'sdk/windows/firefox.js',
|
||||
'sdk/windows/observer.js',
|
||||
'sdk/windows/tabs-fennec.js',
|
||||
]
|
||||
EXTRA_JS_MODULES.commonjs.sdk.windows += [
|
||||
'sdk/windows/fennec.js',
|
||||
'sdk/windows/firefox.js',
|
||||
'sdk/windows/observer.js',
|
||||
'sdk/windows/tabs-fennec.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES.commonjs += [
|
||||
'index.js',
|
||||
|
|
|
|||
|
|
@ -204,11 +204,6 @@ if CONFIG['OS_ARCH'] == 'WINNT':
|
|||
'winspool',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
||||
OS_LIBS += [
|
||||
'dbus',
|
||||
]
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'Linux' and CONFIG['OS_TARGET'] != 'Android':
|
||||
OS_LIBS += [
|
||||
'rt',
|
||||
|
|
@ -252,35 +247,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
|
|||
'GLESv2',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
||||
OS_LIBS += [
|
||||
'ui',
|
||||
'media',
|
||||
'hardware_legacy',
|
||||
'hardware',
|
||||
'utils',
|
||||
'cutils',
|
||||
'sysutils',
|
||||
'camera_client',
|
||||
'sensorservice',
|
||||
'stagefright',
|
||||
'stagefright_foundation',
|
||||
'stagefright_omx',
|
||||
'binder',
|
||||
'gui',
|
||||
'mtp',
|
||||
]
|
||||
|
||||
if int(CONFIG['ANDROID_VERSION']) >= 17:
|
||||
OS_LIBS += [
|
||||
'sync',
|
||||
]
|
||||
|
||||
if CONFIG['ANDROID_VERSION'] >= '16':
|
||||
OS_LIBS += [
|
||||
'mdnssd',
|
||||
]
|
||||
|
||||
if 'rtsp' in CONFIG['NECKO_PROTOCOLS']:
|
||||
OS_LIBS += [
|
||||
'stagefright_foundation',
|
||||
|
|
|
|||
|
|
@ -87,24 +87,6 @@ this.UpdateUtils = {
|
|||
url = url.replace(/%CUSTOM%/g, Preferences.get(PREF_APP_UPDATE_CUSTOM, ""));
|
||||
url = url.replace(/\+/g, "%2B");
|
||||
|
||||
if (AppConstants.platform == "gonk") {
|
||||
let sysLibs = {};
|
||||
Cu.import("resource://gre/modules/systemlibs.js", sysLibs);
|
||||
let productDevice = sysLibs.libcutils.property_get("ro.product.device");
|
||||
let buildType = sysLibs.libcutils.property_get("ro.build.type");
|
||||
url = url.replace(/%PRODUCT_MODEL%/g,
|
||||
sysLibs.libcutils.property_get("ro.product.model"));
|
||||
if (buildType == "user" || buildType == "userdebug") {
|
||||
url = url.replace(/%PRODUCT_DEVICE%/g, productDevice);
|
||||
} else {
|
||||
url = url.replace(/%PRODUCT_DEVICE%/g, productDevice + "-" + buildType);
|
||||
}
|
||||
url = url.replace(/%B2G_VERSION%/g,
|
||||
Preferences.get(PREF_APP_B2G_VERSION, null));
|
||||
url = url.replace(/%IMEI%/g,
|
||||
Preferences.get(PREF_APP_UPDATE_IMEI_HASH, "default"));
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -112,8 +112,7 @@ set_config('L10NBASEDIR', l10n_base)
|
|||
# reason.
|
||||
option('--enable-default-toolkit', nargs=1,
|
||||
choices=('cairo-windows', 'cairo-gtk2', 'cairo-gtk2-x11', 'cairo-gtk3',
|
||||
'cairo-cocoa', 'cairo-uikit', 'cairo-android',
|
||||
'cairo-gonk'),
|
||||
'cairo-cocoa', 'cairo-uikit', 'cairo-android'),
|
||||
help='Select default toolkit')
|
||||
|
||||
@depends('--enable-default-toolkit', target)
|
||||
|
|
@ -232,7 +231,7 @@ set_define(gl_provider_define, True)
|
|||
# ==============================================================
|
||||
@depends(toolkit)
|
||||
def pdf_printing(toolkit):
|
||||
if toolkit in ('windows', 'gtk2', 'gtk3', 'android', 'gonk'):
|
||||
if toolkit in ('windows', 'gtk2', 'gtk3', 'android'):
|
||||
return True
|
||||
|
||||
@depends(pdf_printing)
|
||||
|
|
@ -254,8 +253,8 @@ option(env='MOZ_INSTRUMENT_EVENT_LOOP',
|
|||
|
||||
@depends('MOZ_INSTRUMENT_EVENT_LOOP', toolkit)
|
||||
def instrument_event_loop(value, toolkit):
|
||||
if value or (toolkit in ('windows', 'gtk2', 'gtk3', 'cocoa', 'android',
|
||||
'gonk') and value.origin == 'default'):
|
||||
if value or (toolkit in ('windows', 'gtk2', 'gtk3', 'cocoa',
|
||||
'android') and value.origin == 'default'):
|
||||
return True
|
||||
|
||||
set_config('MOZ_INSTRUMENT_EVENT_LOOP', instrument_event_loop)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# The file is shared between the two main xpcshell manifest files.
|
||||
[DEFAULT]
|
||||
skip-if = toolkit == 'android' || toolkit == 'gonk'
|
||||
skip-if = toolkit == 'android'
|
||||
|
||||
[test_AddonRepository.js]
|
||||
# Bug 676992: test consistently hangs on Android
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
head = head_addons.js head_unpack.js
|
||||
tail =
|
||||
firefox-appdir = browser
|
||||
skip-if = toolkit == 'android' || toolkit == 'gonk'
|
||||
skip-if = toolkit == 'android'
|
||||
dupe-manifest =
|
||||
|
||||
[include:xpcshell-shared.ini]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
[DEFAULT]
|
||||
skip-if = buildapp == 'mulet' || toolkit == 'android' || toolkit == 'gonk'
|
||||
skip-if = buildapp == 'mulet' || toolkit == 'android'
|
||||
head = head_addons.js
|
||||
tail =
|
||||
firefox-appdir = browser
|
||||
|
|
|
|||
|
|
@ -55,8 +55,6 @@ const URI_UPDATES_PROPERTIES = "chrome://mozapps/locale/update/updates.proper
|
|||
|
||||
const KEY_UPDROOT = "UpdRootD";
|
||||
const KEY_EXECUTABLE = "XREExeF";
|
||||
// Gonk only
|
||||
const KEY_UPDATE_ARCHIVE_DIR = "UpdArchD";
|
||||
|
||||
const DIR_UPDATES = "updates";
|
||||
|
||||
|
|
@ -198,17 +196,6 @@ const APPID_TO_TOPIC = {
|
|||
|
||||
var gUpdateMutexHandle = null;
|
||||
|
||||
// Gonk only
|
||||
var gSDCardMountLock = null;
|
||||
|
||||
// Gonk only
|
||||
XPCOMUtils.defineLazyGetter(this, "gExtStorage", function aus_gExtStorage() {
|
||||
if (AppConstants.platform != "gonk") {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
return Services.env.get("EXTERNAL_STORAGE");
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
|
||||
"resource://gre/modules/UpdateUtils.jsm");
|
||||
|
||||
|
|
@ -564,13 +551,6 @@ function getCanStageUpdates() {
|
|||
return true;
|
||||
}
|
||||
|
||||
// For Gonk, the updater will remount the /system partition to move staged
|
||||
// files into place.
|
||||
if (AppConstants.platform == "gonk") {
|
||||
LOG("getCanStageUpdates - able to stage updates because this is gonk");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!hasUpdateMutex()) {
|
||||
LOG("getCanStageUpdates - unable to apply updates because another " +
|
||||
"instance of the application is already handling updates for this " +
|
||||
|
|
@ -797,105 +777,6 @@ function writeVersionFile(dir, version) {
|
|||
writeStringToFile(versionFile, version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gonk only function that reads the link file specified in the update.link file
|
||||
* in the specified directory and returns the nsIFile for the corresponding
|
||||
* file.
|
||||
* @param dir
|
||||
* The dir to look for an update.link file in
|
||||
* @return A nsIFile for the file path specified in the
|
||||
* update.link file or null if the update.link file
|
||||
* doesn't exist.
|
||||
*/
|
||||
function getFileFromUpdateLink(dir) {
|
||||
if (AppConstants.platform != "gonk") {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
let linkFile = dir.clone();
|
||||
linkFile.append(FILE_UPDATE_LINK);
|
||||
let link = readStringFromFile(linkFile);
|
||||
LOG("getFileFromUpdateLink linkFile.path: " + linkFile.path + ", link: " + link);
|
||||
if (!link) {
|
||||
return null;
|
||||
}
|
||||
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
|
||||
file.initWithPath(link);
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gonk only function to create a link file. This allows the actual patch to
|
||||
* live in a directory different from the update directory.
|
||||
* @param dir
|
||||
* The patch directory where the update.link file
|
||||
* should be written.
|
||||
* @param patchFile
|
||||
* The fully qualified filename of the patchfile.
|
||||
*/
|
||||
function writeLinkFile(dir, patchFile) {
|
||||
if (AppConstants.platform != "gonk") {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
let linkFile = dir.clone();
|
||||
linkFile.append(FILE_UPDATE_LINK);
|
||||
writeStringToFile(linkFile, patchFile.path);
|
||||
if (patchFile.path.indexOf(gExtStorage) == 0) {
|
||||
// The patchfile is being stored on external storage. Try to lock it
|
||||
// so that it doesn't get shared with the PC while we're downloading
|
||||
// to it.
|
||||
acquireSDCardMountLock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gonk only function to acquire a VolumeMountLock for the sdcard volume.
|
||||
*
|
||||
* This prevents the SDCard from being shared with the PC while
|
||||
* we're downloading the update.
|
||||
*/
|
||||
function acquireSDCardMountLock() {
|
||||
if (AppConstants.platform != "gonk") {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
let volsvc = Cc["@mozilla.org/telephony/volume-service;1"].
|
||||
getService(Ci.nsIVolumeService);
|
||||
if (volsvc) {
|
||||
gSDCardMountLock = volsvc.createMountLock("sdcard");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gonk only function that determines if the state corresponds to an
|
||||
* interrupted update. This could either be because the download was
|
||||
* interrupted, or because staging the update was interrupted.
|
||||
*
|
||||
* @return true if the state corresponds to an interrupted
|
||||
* update.
|
||||
*/
|
||||
function isInterruptedUpdate(status) {
|
||||
if (AppConstants.platform != "gonk") {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
return (status == STATE_DOWNLOADING) ||
|
||||
(status == STATE_PENDING) ||
|
||||
(status == STATE_APPLYING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases any SDCard mount lock that we might have.
|
||||
*
|
||||
* This once again allows the SDCard to be shared with the PC.
|
||||
*/
|
||||
function releaseSDCardMountLock() {
|
||||
if (AppConstants.platform != "gonk") {
|
||||
throw Cr.NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
if (gSDCardMountLock) {
|
||||
gSDCardMountLock.unlock();
|
||||
gSDCardMountLock = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the service should be used to attempt an update
|
||||
* or not.
|
||||
|
|
@ -1058,14 +939,6 @@ function cleanUpUpdatesDir(aRemovePatchFiles = true) {
|
|||
let dirEntries = updateDir.directoryEntries;
|
||||
while (dirEntries.hasMoreElements()) {
|
||||
let file = dirEntries.getNext().QueryInterface(Ci.nsIFile);
|
||||
if (AppConstants.platform == "gonk") {
|
||||
if (file.leafName == FILE_UPDATE_LINK) {
|
||||
let linkedFile = getFileFromUpdateLink(updateDir);
|
||||
if (linkedFile && linkedFile.exists()) {
|
||||
linkedFile.remove(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now, recursively remove this file. The recursive removal is needed for
|
||||
// Mac OSX because this directory will contain a copy of updater.app,
|
||||
|
|
@ -1078,9 +951,6 @@ function cleanUpUpdatesDir(aRemovePatchFiles = true) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (AppConstants.platform == "gonk") {
|
||||
releaseSDCardMountLock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1809,12 +1679,6 @@ function UpdateService() {
|
|||
LOG("Creating UpdateService");
|
||||
Services.obs.addObserver(this, "xpcom-shutdown", false);
|
||||
Services.prefs.addObserver(PREF_APP_UPDATE_LOG, this, false);
|
||||
if (AppConstants.platform == "gonk") {
|
||||
// PowerManagerService::SyncProfile (which is called for Reboot, PowerOff
|
||||
// and Restart) sends the profile-change-net-teardown event. We can then
|
||||
// pause the download in a similar manner to xpcom-shutdown.
|
||||
Services.obs.addObserver(this, "profile-change-net-teardown", false);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateService.prototype = {
|
||||
|
|
@ -1980,23 +1844,6 @@ UpdateService.prototype = {
|
|||
}
|
||||
}
|
||||
|
||||
if (AppConstants.platform == "gonk") {
|
||||
// This code is called very early in the boot process, before we've even
|
||||
// had a chance to setup the UI so we can give feedback to the user.
|
||||
//
|
||||
// Since the download may be occuring over a link which has associated
|
||||
// cost, we want to require user-consent before resuming the download.
|
||||
// Also, applying an already downloaded update now is undesireable,
|
||||
// since the phone will look dead while the update is being applied.
|
||||
// Applying the update can take several minutes. Instead we wait until
|
||||
// the UI is initialized so it is possible to give feedback to and get
|
||||
// consent to update from the user.
|
||||
if (isInterruptedUpdate(status)) {
|
||||
LOG("UpdateService:_postUpdateProcessing - interrupted update detected - wait for user consent");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (status == STATE_DOWNLOADING) {
|
||||
LOG("UpdateService:_postUpdateProcessing - patch found in downloading " +
|
||||
"state");
|
||||
|
|
@ -2038,34 +1885,6 @@ UpdateService.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
if (AppConstants.platform == "gonk") {
|
||||
// The update is only applied but not selected to be installed
|
||||
if (status == STATE_APPLIED && update && update.isOSUpdate) {
|
||||
LOG("UpdateService:_postUpdateProcessing - update staged as applied found");
|
||||
return;
|
||||
}
|
||||
|
||||
if (status == STATE_APPLIED_OS && update && update.isOSUpdate) {
|
||||
// In gonk, we need to check for OS update status after startup, since
|
||||
// the recovery partition won't write to update.status for us
|
||||
let recoveryService = Cc["@mozilla.org/recovery-service;1"].
|
||||
getService(Ci.nsIRecoveryService);
|
||||
let fotaStatus = recoveryService.getFotaUpdateStatus();
|
||||
switch (fotaStatus) {
|
||||
case Ci.nsIRecoveryService.FOTA_UPDATE_SUCCESS:
|
||||
status = STATE_SUCCEEDED;
|
||||
break;
|
||||
case Ci.nsIRecoveryService.FOTA_UPDATE_FAIL:
|
||||
status = STATE_FAILED + ": " + FOTA_GENERAL_ERROR;
|
||||
break;
|
||||
case Ci.nsIRecoveryService.FOTA_UPDATE_UNKNOWN:
|
||||
default:
|
||||
status = STATE_FAILED + ": " + FOTA_UNKNOWN_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!update) {
|
||||
if (status != STATE_SUCCEEDED) {
|
||||
LOG("UpdateService:_postUpdateProcessing - previous patch failed " +
|
||||
|
|
@ -2519,11 +2338,6 @@ UpdateService.prototype = {
|
|||
var um = Cc["@mozilla.org/updates/update-manager;1"].
|
||||
getService(Ci.nsIUpdateManager);
|
||||
if (um.activeUpdate) {
|
||||
if (AppConstants.platform == "gonk") {
|
||||
// For gonk, the user isn't necessarily aware of the update, so we need
|
||||
// to show the prompt to make sure.
|
||||
this._showPrompt(um.activeUpdate);
|
||||
}
|
||||
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_HAS_ACTIVEUPDATE);
|
||||
return;
|
||||
}
|
||||
|
|
@ -2714,21 +2528,6 @@ UpdateService.prototype = {
|
|||
}
|
||||
this._downloader.cancel();
|
||||
}
|
||||
if (AppConstants.platform == "gonk") {
|
||||
let um = Cc["@mozilla.org/updates/update-manager;1"].
|
||||
getService(Ci.nsIUpdateManager);
|
||||
let activeUpdate = um.activeUpdate;
|
||||
if (activeUpdate &&
|
||||
(activeUpdate.appVersion != update.appVersion ||
|
||||
activeUpdate.buildID != update.buildID)) {
|
||||
// We have an activeUpdate (which presumably was interrupted), and are
|
||||
// about start downloading a new one. Make sure we remove all traces
|
||||
// of the active one (otherwise we'll start appending the new update.mar
|
||||
// the the one that's been partially downloaded).
|
||||
LOG("UpdateService:downloadUpdate - removing stale active update.");
|
||||
cleanupActiveUpdate();
|
||||
}
|
||||
}
|
||||
// Set the previous application version prior to downloading the update.
|
||||
update.previousAppVersion = Services.appinfo.version;
|
||||
this._downloader = new Downloader(background, this);
|
||||
|
|
@ -3142,21 +2941,6 @@ UpdateManager.prototype = {
|
|||
"the update was staged. state: " + update.state + ", status: " + status);
|
||||
Services.obs.notifyObservers(null, "update-staged", update.state);
|
||||
|
||||
if (AppConstants.platform == "gonk") {
|
||||
// Do this after everything else, since it will likely cause the app to
|
||||
// shut down.
|
||||
if (update.state == STATE_APPLIED) {
|
||||
// Notify the user that an update has been staged and is ready for
|
||||
// installation (i.e. that they should restart the application). We do
|
||||
// not notify on failed update attempts.
|
||||
let prompter = Cc["@mozilla.org/updates/update-prompt;1"].
|
||||
createInstance(Ci.nsIUpdatePrompt);
|
||||
prompter.showUpdateDownloaded(update, true);
|
||||
} else {
|
||||
releaseSDCardMountLock();
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Only prompt when the UI isn't already open.
|
||||
let windowType = getPref("getCharPref", PREF_APP_UPDATE_ALTWINDOWTYPE, null);
|
||||
if (Services.wm.getMostRecentWindow(UPDATE_WINDOW_NAME) ||
|
||||
|
|
@ -3515,9 +3299,6 @@ Downloader.prototype = {
|
|||
if (this._request && this._request instanceof Ci.nsIRequest) {
|
||||
this._request.cancel(cancelError);
|
||||
}
|
||||
if (AppConstants.platform == "gonk") {
|
||||
releaseSDCardMountLock();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -3647,17 +3428,8 @@ Downloader.prototype = {
|
|||
return selectedPatch;
|
||||
}
|
||||
|
||||
if (AppConstants.platform == "gonk") {
|
||||
if (state == STATE_PENDING || state == STATE_APPLYING) {
|
||||
LOG("Downloader:_selectPatch - resuming interrupted apply");
|
||||
return selectedPatch;
|
||||
}
|
||||
if (state == STATE_APPLIED) {
|
||||
LOG("Downloader:_selectPatch - already downloaded and staged");
|
||||
return null;
|
||||
}
|
||||
} else if (state == STATE_PENDING || state == STATE_PENDING_SERVICE ||
|
||||
state == STATE_PENDING_ELEVATE) {
|
||||
if (state == STATE_PENDING || state == STATE_PENDING_SERVICE ||
|
||||
state == STATE_PENDING_ELEVATE) {
|
||||
LOG("Downloader:_selectPatch - already downloaded and staged");
|
||||
return null;
|
||||
}
|
||||
|
|
@ -3719,15 +3491,7 @@ Downloader.prototype = {
|
|||
*/
|
||||
_getUpdateArchiveFile: function Downloader__getUpdateArchiveFile() {
|
||||
var updateArchive;
|
||||
if (AppConstants.platform == "gonk") {
|
||||
try {
|
||||
updateArchive = FileUtils.getDir(KEY_UPDATE_ARCHIVE_DIR, [], true);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
updateArchive = getUpdatesDir().clone();
|
||||
}
|
||||
updateArchive = getUpdatesDir().clone();
|
||||
|
||||
updateArchive.append(FILE_UPDATE_MAR);
|
||||
return updateArchive;
|
||||
|
|
@ -3761,71 +3525,6 @@ Downloader.prototype = {
|
|||
|
||||
let patchFile = null;
|
||||
|
||||
// Only used by gonk
|
||||
let status = STATE_NONE;
|
||||
if (AppConstants.platform == "gonk") {
|
||||
status = readStatusFile(updateDir);
|
||||
if (isInterruptedUpdate(status)) {
|
||||
LOG("Downloader:downloadUpdate - interruptted update");
|
||||
// The update was interrupted. Try to locate the existing patch file.
|
||||
// For an interrupted download, this allows a resume rather than a
|
||||
// re-download.
|
||||
patchFile = getFileFromUpdateLink(updateDir);
|
||||
if (!patchFile) {
|
||||
// No link file. We'll just assume that the update.mar is in the
|
||||
// update directory.
|
||||
patchFile = updateDir.clone();
|
||||
patchFile.append(FILE_UPDATE_MAR);
|
||||
}
|
||||
if (patchFile.exists()) {
|
||||
LOG("Downloader:downloadUpdate - resuming with patchFile " + patchFile.path);
|
||||
if (patchFile.fileSize == this._patch.size) {
|
||||
LOG("Downloader:downloadUpdate - patchFile appears to be fully downloaded");
|
||||
// Bump the status along so that we don't try to redownload again.
|
||||
if (getElevationRequired()) {
|
||||
status = STATE_PENDING_ELEVATE;
|
||||
} else {
|
||||
status = STATE_PENDING;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG("Downloader:downloadUpdate - patchFile " + patchFile.path +
|
||||
" doesn't exist - performing full download");
|
||||
// The patchfile doesn't exist, we might as well treat this like
|
||||
// a new download.
|
||||
patchFile = null;
|
||||
}
|
||||
if (patchFile && status != STATE_DOWNLOADING) {
|
||||
// It looks like the patch was downloaded, but got interrupted while it
|
||||
// was being verified or applied. So we'll fake the downloading portion.
|
||||
|
||||
if (getElevationRequired()) {
|
||||
writeStatusFile(updateDir, STATE_PENDING_ELEVATE);
|
||||
} else {
|
||||
writeStatusFile(updateDir, STATE_PENDING);
|
||||
}
|
||||
|
||||
// Since the code expects the onStopRequest callback to happen
|
||||
// asynchronously (And you have to call AUS_addDownloadListener
|
||||
// after calling AUS_downloadUpdate) we need to defer this.
|
||||
|
||||
this._downloadTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
this._downloadTimer.initWithCallback(function() {
|
||||
this._downloadTimer = null;
|
||||
// Send a fake onStopRequest. Filling in the destination allows
|
||||
// _verifyDownload to work, and then the update will be applied.
|
||||
this._request = {destination: patchFile};
|
||||
this.onStopRequest(this._request, null, Cr.NS_OK);
|
||||
}.bind(this), 0, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
|
||||
// Returning STATE_DOWNLOADING makes UpdatePrompt think we're
|
||||
// downloading. The onStopRequest that we spoofed above will make it
|
||||
// look like the download finished.
|
||||
return STATE_DOWNLOADING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!patchFile) {
|
||||
// Find a place to put the patchfile that we're going to download.
|
||||
patchFile = this._getUpdateArchiveFile();
|
||||
|
|
@ -3836,19 +3535,6 @@ Downloader.prototype = {
|
|||
return STATE_NONE;
|
||||
}
|
||||
|
||||
if (AppConstants.platform == "gonk") {
|
||||
if (patchFile.path.indexOf(updateDir.path) != 0) {
|
||||
// The patchFile is in a directory which is different from the
|
||||
// updateDir, create a link file.
|
||||
writeLinkFile(updateDir, patchFile);
|
||||
|
||||
if (!isInterruptedUpdate(status) && patchFile.exists()) {
|
||||
// Remove stale patchFile
|
||||
patchFile.remove(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update.QueryInterface(Ci.nsIPropertyBag);
|
||||
let interval = this.background ? update.getProperty("backgroundInterval")
|
||||
: DOWNLOAD_FOREGROUND_INTERVAL;
|
||||
|
|
@ -4119,13 +3805,6 @@ Downloader.prototype = {
|
|||
this._update.statusText = getStatusTextFromCode(status,
|
||||
Cr.NS_BINDING_FAILED);
|
||||
|
||||
if (AppConstants.platform == "gonk") {
|
||||
// bug891009: On FirefoxOS, manaully retry OTA download will reuse
|
||||
// the Update object. We need to remove selected patch so that download
|
||||
// can be triggered again successfully.
|
||||
this._update.selectedPatch.selected = false;
|
||||
}
|
||||
|
||||
// Destroy the updates directory, since we're done with it.
|
||||
cleanUpUpdatesDir();
|
||||
|
||||
|
|
@ -4187,13 +3866,6 @@ Downloader.prototype = {
|
|||
}
|
||||
}
|
||||
|
||||
if (AppConstants.platform == "gonk") {
|
||||
// We always forward errors in B2G, since Gaia controls the update UI
|
||||
let prompter = Cc["@mozilla.org/updates/update-prompt;1"].
|
||||
createInstance(Ci.nsIUpdatePrompt);
|
||||
prompter.showUpdateError(this._update);
|
||||
}
|
||||
|
||||
// Prevent leaking the update object (bug 454964).
|
||||
this._update = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,251 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* 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 <android/log.h>
|
||||
#include <cutils/android_reboot.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "automounter_gonk.h"
|
||||
#include "updatedefines.h"
|
||||
#include "updatelogging.h"
|
||||
|
||||
#define LOG_TAG "GonkAutoMounter"
|
||||
|
||||
#define GONK_LOG(level, format, ...) \
|
||||
LOG((LOG_TAG ": " format "\n", ##__VA_ARGS__)); \
|
||||
__android_log_print(level, LOG_TAG, format, ##__VA_ARGS__)
|
||||
|
||||
#define LOGI(format, ...) GONK_LOG(ANDROID_LOG_INFO, format, ##__VA_ARGS__)
|
||||
#define LOGE(format, ...) GONK_LOG(ANDROID_LOG_ERROR, format, ##__VA_ARGS__)
|
||||
|
||||
const char *kGonkMountsPath = "/proc/mounts";
|
||||
const char *kGonkSystemPath = "/system";
|
||||
|
||||
GonkAutoMounter::GonkAutoMounter() : mDevice(nullptr), mAccess(Unknown)
|
||||
{
|
||||
if (!RemountSystem(ReadWrite)) {
|
||||
LOGE("Could not remount %s as read-write.", kGonkSystemPath);
|
||||
}
|
||||
}
|
||||
|
||||
GonkAutoMounter::~GonkAutoMounter()
|
||||
{
|
||||
bool result = RemountSystem(ReadOnly);
|
||||
free(mDevice);
|
||||
|
||||
if (!result) {
|
||||
// Don't take any chances when remounting as read-only fails, just reboot.
|
||||
Reboot();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GonkAutoMounter::Reboot()
|
||||
{
|
||||
// The android_reboot wrapper provides more safety, doing fancier read-only
|
||||
// remounting and attempting to sync() the filesystem first. If this fails
|
||||
// our only hope is to force a reboot directly without these protections.
|
||||
// For more, see system/core/libcutils/android_reboot.c
|
||||
LOGE("Could not remount %s as read-only, forcing a system reboot.",
|
||||
kGonkSystemPath);
|
||||
LogFlush();
|
||||
|
||||
if (android_reboot(ANDROID_RB_RESTART, 0, nullptr) != 0) {
|
||||
LOGE("Safe system reboot failed, attempting to force");
|
||||
LogFlush();
|
||||
|
||||
if (reboot(RB_AUTOBOOT) != 0) {
|
||||
LOGE("CRITICAL: Failed to force restart");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
MountAccessToString(MountAccess access)
|
||||
{
|
||||
switch (access) {
|
||||
case ReadOnly: return "read-only";
|
||||
case ReadWrite: return "read-write";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
GonkAutoMounter::RemountSystem(MountAccess access)
|
||||
{
|
||||
if (!UpdateMountStatus()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mAccess == access) {
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned long flags = MS_REMOUNT;
|
||||
if (access == ReadOnly) {
|
||||
flags |= MS_RDONLY;
|
||||
// Give the system a chance to flush file buffers
|
||||
sync();
|
||||
}
|
||||
|
||||
if (!MountSystem(flags)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check status again to verify /system has been properly remounted
|
||||
if (!UpdateMountStatus()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mAccess != access) {
|
||||
LOGE("Updated mount status %s should be %s",
|
||||
MountAccessToString(mAccess),
|
||||
MountAccessToString(access));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
GonkAutoMounter::UpdateMountStatus()
|
||||
{
|
||||
FILE *mountsFile = NS_tfopen(kGonkMountsPath, "r");
|
||||
|
||||
if (mountsFile == nullptr) {
|
||||
LOGE("Error opening %s: %s", kGonkMountsPath, strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
// /proc/mounts returns a 0 size from fstat, so we use the same
|
||||
// pre-allocated buffer size that ADB does here
|
||||
const int mountsMaxSize = 4096;
|
||||
char mountData[mountsMaxSize];
|
||||
size_t read = fread(mountData, 1, mountsMaxSize - 1, mountsFile);
|
||||
mountData[read + 1] = '\0';
|
||||
|
||||
if (ferror(mountsFile)) {
|
||||
LOGE("Error reading %s, %s", kGonkMountsPath, strerror(errno));
|
||||
fclose(mountsFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
char *token, *tokenContext;
|
||||
bool foundSystem = false;
|
||||
|
||||
for (token = strtok_r(mountData, "\n", &tokenContext);
|
||||
token;
|
||||
token = strtok_r(nullptr, "\n", &tokenContext))
|
||||
{
|
||||
if (ProcessMount(token)) {
|
||||
foundSystem = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(mountsFile);
|
||||
|
||||
if (!foundSystem) {
|
||||
LOGE("Couldn't find %s mount in %s", kGonkSystemPath, kGonkMountsPath);
|
||||
}
|
||||
return foundSystem;
|
||||
}
|
||||
|
||||
bool
|
||||
GonkAutoMounter::ProcessMount(const char *mount)
|
||||
{
|
||||
const int strSize = 256;
|
||||
char mountDev[strSize];
|
||||
char mountDir[strSize];
|
||||
char mountAccess[strSize];
|
||||
|
||||
int rv = sscanf(mount, "%255s %255s %*s %255s %*d %*d\n",
|
||||
mountDev, mountDir, mountAccess);
|
||||
mountDev[strSize - 1] = '\0';
|
||||
mountDir[strSize - 1] = '\0';
|
||||
mountAccess[strSize - 1] = '\0';
|
||||
|
||||
if (rv != 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strcmp(kGonkSystemPath, mountDir) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
free(mDevice);
|
||||
mDevice = strdup(mountDev);
|
||||
mAccess = Unknown;
|
||||
|
||||
char *option, *optionContext;
|
||||
for (option = strtok_r(mountAccess, ",", &optionContext);
|
||||
option;
|
||||
option = strtok_r(nullptr, ",", &optionContext))
|
||||
{
|
||||
if (strcmp("ro", option) == 0) {
|
||||
mAccess = ReadOnly;
|
||||
break;
|
||||
} else if (strcmp("rw", option) == 0) {
|
||||
mAccess = ReadWrite;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Mark the given block device as read-write or read-only, using the BLKROSET
|
||||
* ioctl.
|
||||
*/
|
||||
static void SetBlockReadWriteStatus(const char *blockdev, bool setReadOnly) {
|
||||
int fd;
|
||||
int roMode = setReadOnly ? 1 : 0;
|
||||
|
||||
fd = open(blockdev, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ioctl(fd, BLKROSET, &roMode) == -1) {
|
||||
LOGE("Error setting read-only mode on %s to %s: %s", blockdev,
|
||||
setReadOnly ? "true": "false", strerror(errno));
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
GonkAutoMounter::MountSystem(unsigned long flags)
|
||||
{
|
||||
if (!mDevice) {
|
||||
LOGE("No device was found for %s", kGonkSystemPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Without setting the block device ro mode to false, we get a permission
|
||||
// denied error while trying to remount it in read-write.
|
||||
SetBlockReadWriteStatus(mDevice, (flags & MS_RDONLY));
|
||||
|
||||
const char *readOnly = flags & MS_RDONLY ? "read-only" : "read-write";
|
||||
int result = mount(mDevice, kGonkSystemPath, "none", flags, nullptr);
|
||||
|
||||
if (result != 0) {
|
||||
LOGE("Error mounting %s as %s: %s", kGonkSystemPath, readOnly,
|
||||
strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
LOGI("Mounted %s partition as %s", kGonkSystemPath, readOnly);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef AUTOMOUNTER_GONK_H__
|
||||
#define AUTOMOUNTER_GONK_H__
|
||||
|
||||
typedef enum {
|
||||
ReadOnly,
|
||||
ReadWrite,
|
||||
Unknown
|
||||
} MountAccess;
|
||||
|
||||
/**
|
||||
* This class will remount the /system partition as read-write in Gonk to allow
|
||||
* the updater write access. Upon destruction, /system will be remounted back to
|
||||
* read-only. If something causes /system to remain read-write, this class will
|
||||
* reboot the device and allow the system to mount as read-only.
|
||||
*
|
||||
* Code inspired from AOSP system/core/adb/remount_service.c
|
||||
*/
|
||||
class GonkAutoMounter
|
||||
{
|
||||
public:
|
||||
GonkAutoMounter();
|
||||
~GonkAutoMounter();
|
||||
|
||||
MountAccess GetAccess() const
|
||||
{
|
||||
return mAccess;
|
||||
}
|
||||
|
||||
private:
|
||||
bool RemountSystem(MountAccess access);
|
||||
bool ForceRemountReadOnly();
|
||||
bool UpdateMountStatus();
|
||||
bool ProcessMount(const char *mount);
|
||||
bool MountSystem(unsigned long flags);
|
||||
void Reboot();
|
||||
|
||||
private:
|
||||
char *mDevice;
|
||||
MountAccess mAccess;
|
||||
};
|
||||
|
||||
#endif // AUTOMOUNTER_GONK_H__
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: sw=2 ts=8 et :
|
||||
*/
|
||||
/* 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 <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "android/log.h"
|
||||
|
||||
#include "progressui.h"
|
||||
|
||||
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GeckoUpdater" , ## args)
|
||||
|
||||
using namespace std;
|
||||
|
||||
int InitProgressUI(int *argc, char ***argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ShowProgressUI()
|
||||
{
|
||||
LOG("Starting to apply update ...\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QuitProgressUI()
|
||||
{
|
||||
LOG("Finished applying update\n");
|
||||
}
|
||||
|
||||
void UpdateProgressUI(float progress)
|
||||
{
|
||||
assert(0.0f <= progress && progress <= 100.0f);
|
||||
|
||||
static const size_t kProgressBarLength = 50;
|
||||
static size_t sLastNumBars;
|
||||
size_t numBars = size_t(float(kProgressBarLength) * progress / 100.0f);
|
||||
if (numBars == sLastNumBars) {
|
||||
return;
|
||||
}
|
||||
sLastNumBars = numBars;
|
||||
|
||||
size_t numSpaces = kProgressBarLength - numBars;
|
||||
string bars(numBars, '=');
|
||||
string spaces(numSpaces, ' ');
|
||||
LOG("Progress [ %s%s ]\n", bars.c_str(), spaces.c_str());
|
||||
}
|
||||
|
|
@ -90,17 +90,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
|||
LOCAL_INCLUDES += [
|
||||
'/toolkit/xre',
|
||||
]
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
||||
have_progressui = 1
|
||||
srcs += [
|
||||
'automounter_gonk.cpp',
|
||||
'progressui_gonk.cpp',
|
||||
]
|
||||
DISABLE_STL_WRAPPING = True
|
||||
OS_LIBS += [
|
||||
'cutils',
|
||||
'sysutils',
|
||||
]
|
||||
|
||||
if have_progressui == 0:
|
||||
srcs += [
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ DIRS += [
|
|||
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
|
||||
DIRS += ['/toolkit/system/gnome']
|
||||
|
||||
if CONFIG['ENABLE_MARIONETTE'] or CONFIG['MOZ_WIDGET_TOOLKIT'] not in ('gonk', 'android'):
|
||||
if CONFIG['ENABLE_MARIONETTE'] or CONFIG['MOZ_WIDGET_TOOLKIT'] not in ('android'):
|
||||
DIRS += [
|
||||
'/testing/firefox-ui',
|
||||
'/testing/marionette',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue