Bug 1346200 - Remove B2G code branches from Telemetry JS modules. r=chutten

--HG--
extra : rebase_source : 4b254a3a05eaa6b7fc3b6c867c90309a3a9911eb
This commit is contained in:
Alisha 2017-03-31 17:55:00 -04:00
Родитель 57d890fb9c
Коммит f7de1de382
7 изменённых файлов: 38 добавлений и 63 удалений

Просмотреть файл

@ -27,11 +27,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",
@ -560,11 +558,9 @@ EnvironmentAddonBuilder.prototype = {
async _updateAddons() {
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 = {
@ -800,14 +796,8 @@ function EnvironmentCache() {
// until the initial environment has been built.
let p = [];
if (AppConstants.platform === "gonk") {
this._addonBuilder = {
watchForChanges() {}
};
} 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());
@ -1201,10 +1191,6 @@ EnvironmentCache.prototype = {
* @returns null on error, true if we are the default browser, or false otherwise.
*/
_isDefaultBrowser() {
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;
@ -1261,10 +1247,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 =
@ -1368,7 +1352,7 @@ EnvironmentCache.prototype = {
* not a portable device.
*/
_getDeviceData() {
if (!["gonk", "android"].includes(AppConstants.platform)) {
if (AppConstants.platform !== "android") {
return null;
}
@ -1391,7 +1375,7 @@ EnvironmentCache.prototype = {
locale: forceToStringOrNull(getSystemLocale()),
};
if (["gonk", "android"].includes(AppConstants.platform)) {
if (AppConstants.platform == "android") {
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.
@ -1455,7 +1439,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();
@ -1520,7 +1504,7 @@ EnvironmentCache.prototype = {
if (AppConstants.platform === "win") {
data.isWow64 = getSysinfoProperty("isWow64", null);
} else if (["gonk", "android"].includes(AppConstants.platform)) {
} else if (AppConstants.platform == "android") {
data.device = this._getDeviceData();
}

Просмотреть файл

@ -1378,7 +1378,7 @@ var Impl = {
let payload;
try {
const isMobile = ["gonk", "android"].includes(AppConstants.platform);
const isMobile = (AppConstants.platform == "android");
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 == "android")
? PENDING_PINGS_QUOTA_BYTES_MOBILE
: PENDING_PINGS_QUOTA_BYTES_DESKTOP,
};

Просмотреть файл

@ -114,7 +114,7 @@ Structure:
os: {
name: <string>, // "Windows_NT" or null on failure
version: <string>, // e.g. "6.1", null on failure
kernelVersion: <string>, // android/b2g only or null on failure
kernelVersion: <string>, // android only or null on failure
servicePackMajor: <number>, // windows only or null on failure
servicePackMinor: <number>, // windows only or null on failure
windowsBuildNumber: <number>, // windows only or null on failure
@ -255,7 +255,7 @@ Structure:
id: <string>, // id
branch: <string>, // branch name
},
persona: <string>, // id of the current persona, null on GONK
persona: <string>, // id of the current persona
},
experiments: {
"<experiment id>": { branch: "<branch>" },
@ -363,7 +363,7 @@ This object contains operating system information.
- ``name``: the name of the OS.
- ``version``: a string representing the OS version.
- ``kernelVersion``: an Android/B2G only string representing the kernel version.
- ``kernelVersion``: an Android only string representing the kernel version.
- ``servicePackMajor``: the Windows only major version number for the installed service pack.
- ``servicePackMinor``: the Windows only minor version number for the installed service pack.
- ``windowsBuildNumber``: the Windows build number.

Просмотреть файл

@ -21,7 +21,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "TelemetrySend",
const gIsWindows = AppConstants.platform == "win";
const gIsMac = AppConstants.platform == "macosx";
const gIsAndroid = AppConstants.platform == "android";
const gIsGonk = AppConstants.platform == "gonk";
const gIsLinux = AppConstants.platform == "linux";
const Telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);

Просмотреть файл

@ -15,7 +15,7 @@ Cu.import("resource://gre/modules/FileUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AttributionCode",
"resource:///modules/AttributionCode.jsm");
// Lazy load |LightweightThemeManager|, we won't be using it on Gonk.
// Lazy load |LightweightThemeManager|.
XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
"resource://gre/modules/LightweightThemeManager.jsm");
@ -417,13 +417,8 @@ function checkSettingsSection(data) {
f + " must have the correct type.");
}
// Check "addonCompatibilityCheckEnabled" separately, as it is not available
// on Gonk.
if (gIsGonk) {
Assert.ok(!("addonCompatibilityCheckEnabled" in data.settings), "Must not be available on Gonk.");
} else {
Assert.equal(data.settings.addonCompatibilityCheckEnabled, AddonManager.checkCompatibility);
}
// Check "addonCompatibilityCheckEnabled" separately.
Assert.equal(data.settings.addonCompatibilityCheckEnabled, AddonManager.checkCompatibility);
// Check "isDefaultBrowser" separately, as it is not available on Android an can either be
// null or boolean on other platforms.
@ -558,8 +553,8 @@ function checkSystemSection(data) {
Assert.ok(Number.isFinite(cpuData.count), "CPU count must be a number.");
Assert.ok(Array.isArray(cpuData.extensions), "CPU extensions must be available.");
// Device data is only available on Android or Gonk.
if (gIsAndroid || gIsGonk) {
// Device data is only available on Android.
if (gIsAndroid) {
let deviceData = data.system.device;
Assert.ok(checkNullOrString(deviceData.model));
Assert.ok(checkNullOrString(deviceData.manufacturer));
@ -588,7 +583,7 @@ function checkSystemSection(data) {
Assert.ok((osData["windowsUBR"] === null) || Number.isFinite(osData["windowsUBR"]),
"windowsUBR must be null or a number.");
}
} else if (gIsAndroid || gIsGonk) {
} else if (gIsAndroid) {
Assert.ok(checkNullOrString(osData.kernelVersion));
}
@ -835,11 +830,9 @@ add_task(function* setup() {
system_addon.lastModifiedTime = SYSTEM_ADDON_INSTALL_DATE;
loadAddonManager(APP_ID, APP_NAME, APP_VERSION, PLATFORM_VERSION);
// Spoof the persona ID, but not on Gonk.
if (!gIsGonk) {
LightweightThemeManager.currentTheme =
spoofTheme(PERSONA_ID, PERSONA_NAME, PERSONA_DESCRIPTION);
}
// Spoof the persona ID.
LightweightThemeManager.currentTheme =
spoofTheme(PERSONA_ID, PERSONA_NAME, PERSONA_DESCRIPTION);
// Register a fake plugin host for consistent flash version data.
registerFakePluginHost();
@ -1199,8 +1192,7 @@ add_task(function* test_addonsAndPlugins() {
Assert.ok(targetPlugin.mimeTypes.find(m => m == PLUGIN_MIME_TYPE2));
Assert.ok(!targetPlugin.mimeTypes.find(m => m == "Not There."));
let personaId = (gIsGonk) ? null : PERSONA_ID;
Assert.equal(data.addons.persona, personaId, "The correct Persona Id must be reported.");
Assert.equal(data.addons.persona, PERSONA_ID, "The correct Persona Id must be reported.");
// Uninstall the addon.
yield AddonManagerTesting.uninstallAddonByID(ADDON_ID);

Просмотреть файл

@ -1584,7 +1584,7 @@ add_task(function* test_invalidSessionData() {
});
add_task(function* test_abortedSession() {
if (gIsAndroid || gIsGonk) {
if (gIsAndroid) {
// We don't have the aborted session ping here.
return;
}
@ -1665,7 +1665,7 @@ add_task(function* test_abortedSession() {
});
add_task(function* test_abortedSession_Shutdown() {
if (gIsAndroid || gIsGonk) {
if (gIsAndroid) {
// We don't have the aborted session ping here.
return;
}
@ -1698,7 +1698,7 @@ add_task(function* test_abortedSession_Shutdown() {
});
add_task(function* test_abortedDailyCoalescing() {
if (gIsAndroid || gIsGonk) {
if (gIsAndroid) {
// We don't have the aborted session or the daily ping here.
return;
}
@ -1751,7 +1751,7 @@ add_task(function* test_abortedDailyCoalescing() {
});
add_task(function* test_schedulerComputerSleep() {
if (gIsAndroid || gIsGonk) {
if (gIsAndroid) {
// We don't have the aborted session or the daily ping here.
return;
}
@ -1808,7 +1808,7 @@ add_task(function* test_schedulerComputerSleep() {
});
add_task(function* test_schedulerEnvironmentReschedules() {
if (gIsAndroid || gIsGonk) {
if (gIsAndroid) {
// We don't have the aborted session or the daily ping here.
return;
}
@ -1854,7 +1854,7 @@ add_task(function* test_schedulerEnvironmentReschedules() {
});
add_task(function* test_schedulerNothingDue() {
if (gIsAndroid || gIsGonk) {
if (gIsAndroid) {
// We don't have the aborted session or the daily ping here.
return;
}
@ -1951,7 +1951,7 @@ add_task(function* test_pingExtendedStats() {
});
add_task(function* test_schedulerUserIdle() {
if (gIsAndroid || gIsGonk) {
if (gIsAndroid) {
// We don't have the aborted session or the daily ping here.
return;
}
@ -1996,7 +1996,7 @@ add_task(function* test_schedulerUserIdle() {
});
add_task(function* test_DailyDueAndIdle() {
if (gIsAndroid || gIsGonk) {
if (gIsAndroid) {
// We don't have the aborted session or the daily ping here.
return;
}
@ -2047,7 +2047,7 @@ add_task(function* test_DailyDueAndIdle() {
});
add_task(function* test_userIdleAndSchedlerTick() {
if (gIsAndroid || gIsGonk) {
if (gIsAndroid) {
// We don't have the aborted session or the daily ping here.
return;
}