зеркало из https://github.com/mozilla/gecko-dev.git
bug 1404080 - Add dwBuildNumber and UBR to the Windows version in the OS_VERSION replacement for the app.update.url. r=mhowell
This commit is contained in:
Родитель
6a4d37f8bb
Коммит
ffba5d31b5
|
@ -12,6 +12,9 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|||
Cu.import("resource://gre/modules/ctypes.jsm");
|
||||
Cu.importGlobalProperties(["fetch"]); /* globals fetch */
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "WindowsRegistry",
|
||||
"resource://gre/modules/WindowsRegistry.jsm");
|
||||
|
||||
const FILE_UPDATE_LOCALE = "update.locale";
|
||||
const PREF_APP_DISTRIBUTION = "distribution.id";
|
||||
const PREF_APP_DISTRIBUTION_VERSION = "distribution.version";
|
||||
|
@ -361,7 +364,8 @@ XPCOMUtils.defineLazyGetter(UpdateUtils, "OSVersion", function() {
|
|||
|
||||
if (0 !== GetVersionEx(winVer.address())) {
|
||||
osVersion += "." + winVer.wServicePackMajor +
|
||||
"." + winVer.wServicePackMinor;
|
||||
"." + winVer.wServicePackMinor +
|
||||
"." + winVer.dwBuildNumber;
|
||||
} else {
|
||||
Cu.reportError("Unknown failure in GetVersionEX (returned 0)");
|
||||
osVersion += ".unknown";
|
||||
|
@ -370,6 +374,14 @@ XPCOMUtils.defineLazyGetter(UpdateUtils, "OSVersion", function() {
|
|||
Cu.reportError("Error getting service pack information. Exception: " + e);
|
||||
osVersion += ".unknown";
|
||||
}
|
||||
|
||||
if (Services.vc.compare(Services.sysinfo.getProperty("version"), "10") >= 0) {
|
||||
const WINDOWS_UBR_KEY_PATH = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
|
||||
let ubr = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE,
|
||||
WINDOWS_UBR_KEY_PATH, "UBR",
|
||||
Ci.nsIWindowsRegKey.WOW64_64);
|
||||
osVersion += (ubr !== undefined) ? "." + ubr : ".unknown";
|
||||
}
|
||||
} finally {
|
||||
kernel32.close();
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ with Files('tests/xpcshell/test_NewTabUtils.js'):
|
|||
BUG_COMPONENT = ('Firefox', 'New Tab Page')
|
||||
|
||||
with Files('tests/xpcshell/test_UpdateUtils*.js'):
|
||||
BUG_COMPONENT = ('Toolkit', 'General')
|
||||
BUG_COMPONENT = ('Toolkit', 'Application Update')
|
||||
|
||||
with Files('tests/xpcshell/test_client_id.js'):
|
||||
BUG_COMPONENT = ('Toolkit', 'Telemetry')
|
||||
|
@ -143,7 +143,7 @@ with Files('Sqlite.jsm'):
|
|||
BUG_COMPONENT = ('Toolkit', 'Storage')
|
||||
|
||||
with Files('UpdateUtils.jsm'):
|
||||
BUG_COMPONENT = ('Toolkit', 'Add-ons Manager')
|
||||
BUG_COMPONENT = ('Toolkit', 'Application Update')
|
||||
|
||||
with Files('WindowsRegistry.jsm'):
|
||||
BUG_COMPONENT = ('Toolkit', 'General')
|
||||
|
|
|
@ -9,8 +9,12 @@ Cu.import("resource://gre/modules/UpdateUtils.jsm");
|
|||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
||||
Cu.import("resource://testing-common/AppInfo.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/ctypes.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "WindowsRegistry",
|
||||
"resource://gre/modules/WindowsRegistry.jsm");
|
||||
|
||||
const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
|
||||
const PREF_APP_PARTNER_BRANCH = "app.partner.";
|
||||
const PREF_DISTRIBUTION_ID = "distribution.id";
|
||||
|
@ -71,7 +75,8 @@ function getServicePack() {
|
|||
throw ("Failure in GetVersionEx (returned 0)");
|
||||
}
|
||||
|
||||
return winVer.wServicePackMajor + "." + winVer.wServicePackMinor;
|
||||
return winVer.wServicePackMajor + "." + winVer.wServicePackMinor + "." +
|
||||
winVer.dwBuildNumber;
|
||||
} finally {
|
||||
kernel32.close();
|
||||
}
|
||||
|
@ -282,9 +287,8 @@ add_task(async function test_platform_version() {
|
|||
// url constructed with %OS_VERSION%
|
||||
add_task(async function test_os_version() {
|
||||
let url = URL_PREFIX + "%OS_VERSION%/";
|
||||
let osVersion;
|
||||
let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
|
||||
osVersion = sysInfo.getProperty("name") + " " + sysInfo.getProperty("version");
|
||||
let osVersion = Services.sysinfo.getProperty("name") + " " +
|
||||
Services.sysinfo.getProperty("version");
|
||||
|
||||
if (AppConstants.platform == "win") {
|
||||
try {
|
||||
|
@ -294,20 +298,24 @@ add_task(async function test_os_version() {
|
|||
do_throw("Failure obtaining service pack: " + e);
|
||||
}
|
||||
|
||||
if ("5.0" === sysInfo.getProperty("version")) { // Win2K
|
||||
osVersion += " (unknown)";
|
||||
} else {
|
||||
try {
|
||||
osVersion += " (" + getProcArchitecture() + ")";
|
||||
} catch (e) {
|
||||
do_throw("Failed to obtain processor architecture: " + e);
|
||||
}
|
||||
if (Services.vc.compare(Services.sysinfo.getProperty("version"), "10") >= 0) {
|
||||
const WINDOWS_UBR_KEY_PATH = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
|
||||
let ubr = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE,
|
||||
WINDOWS_UBR_KEY_PATH, "UBR",
|
||||
Ci.nsIWindowsRegKey.WOW64_64);
|
||||
osVersion += (ubr !== undefined) ? "." + ubr : ".unknown";
|
||||
}
|
||||
|
||||
try {
|
||||
osVersion += " (" + getProcArchitecture() + ")";
|
||||
} catch (e) {
|
||||
do_throw("Failed to obtain processor architecture: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
if (osVersion) {
|
||||
try {
|
||||
osVersion += " (" + sysInfo.getProperty("secondaryLibrary") + ")";
|
||||
osVersion += " (" + Services.sysinfo.getProperty("secondaryLibrary") + ")";
|
||||
} catch (e) {
|
||||
// Not all platforms have a secondary widget library, so an error is
|
||||
// nothing to worry about.
|
||||
|
|
Загрузка…
Ссылка в новой задаче