summaryrefslogtreecommitdiffstats
path: root/toolkit
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/components/telemetry/TelemetryController.jsm2
-rw-r--r--toolkit/components/telemetry/TelemetryEnvironment.jsm2
-rw-r--r--toolkit/components/telemetry/TelemetryReportingPolicy.jsm2
-rw-r--r--toolkit/locales/Makefile.in3
-rw-r--r--toolkit/locales/update.locale1
-rw-r--r--toolkit/modules/ExtensionStorage.jsm241
-rw-r--r--toolkit/modules/UpdateUtils.jsm314
-rw-r--r--toolkit/modules/moz.build1
-rw-r--r--toolkit/mozapps/installer/l10n-repack.py1
-rw-r--r--toolkit/xre/nsAppRunner.cpp17
10 files changed, 342 insertions, 242 deletions
diff --git a/toolkit/components/telemetry/TelemetryController.jsm b/toolkit/components/telemetry/TelemetryController.jsm
index b8de776da..86de87d02 100644
--- a/toolkit/components/telemetry/TelemetryController.jsm
+++ b/toolkit/components/telemetry/TelemetryController.jsm
@@ -365,7 +365,7 @@ var Impl = {
let updateChannel = null;
try {
- updateChannel = UpdateUtils.getUpdateChannel(false);
+ updateChannel = UpdateUtils.UpdateChannel;
} catch (e) {
this._log.trace("_getApplicationSection - Unable to get update channel.", e);
}
diff --git a/toolkit/components/telemetry/TelemetryEnvironment.jsm b/toolkit/components/telemetry/TelemetryEnvironment.jsm
index 391ea4bb4..f88dfc5f0 100644
--- a/toolkit/components/telemetry/TelemetryEnvironment.jsm
+++ b/toolkit/components/telemetry/TelemetryEnvironment.jsm
@@ -1106,7 +1106,7 @@ EnvironmentCache.prototype = {
_updateSettings: function () {
let updateChannel = null;
try {
- updateChannel = UpdateUtils.getUpdateChannel(false);
+ updateChannel = UpdateUtils.UpdateChannel;
} catch (e) {}
this._currentEnvironment.settings = {
diff --git a/toolkit/components/telemetry/TelemetryReportingPolicy.jsm b/toolkit/components/telemetry/TelemetryReportingPolicy.jsm
index d9c99df49..6ad534f53 100644
--- a/toolkit/components/telemetry/TelemetryReportingPolicy.jsm
+++ b/toolkit/components/telemetry/TelemetryReportingPolicy.jsm
@@ -254,7 +254,7 @@ var TelemetryReportingPolicyImpl = {
// use the general minimum policy version.
let channel = "";
try {
- channel = UpdateUtils.getUpdateChannel(false);
+ channel = UpdateUtils.UpdateChannel;
} catch (e) {
this._log.error("minimumPolicyVersion - Unable to retrieve the current channel.");
return minPolicyVersion;
diff --git a/toolkit/locales/Makefile.in b/toolkit/locales/Makefile.in
index 198d9aaa8..585c70986 100644
--- a/toolkit/locales/Makefile.in
+++ b/toolkit/locales/Makefile.in
@@ -29,6 +29,3 @@ chrome-%:
@$(MAKE) -C $(DEPTH)/security/manager/locales/ chrome AB_CD=$*
@$(MAKE) chrome AB_CD=$*
-libs:: update.locale
- sed -e 's/%AB_CD%/$(AB_CD)/' $< > $(FINAL_TARGET)/update.locale
-
diff --git a/toolkit/locales/update.locale b/toolkit/locales/update.locale
deleted file mode 100644
index 7c1f386ee..000000000
--- a/toolkit/locales/update.locale
+++ /dev/null
@@ -1 +0,0 @@
-%AB_CD%
diff --git a/toolkit/modules/ExtensionStorage.jsm b/toolkit/modules/ExtensionStorage.jsm
new file mode 100644
index 000000000..0b0ffb000
--- /dev/null
+++ b/toolkit/modules/ExtensionStorage.jsm
@@ -0,0 +1,241 @@
+/* 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/. */
+
+"use strict";
+
+this.EXPORTED_SYMBOLS = ["ExtensionStorage"];
+
+const Ci = Components.interfaces;
+const Cc = Components.classes;
+const Cu = Components.utils;
+const Cr = Components.results;
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "OS",
+ "resource://gre/modules/osfile.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "AsyncShutdown",
+ "resource://gre/modules/AsyncShutdown.jsm");
+
+function jsonReplacer(key, value) {
+ switch (typeof(value)) {
+ // Serialize primitive types as-is.
+ case "string":
+ case "number":
+ case "boolean":
+ return value;
+
+ case "object":
+ if (value === null) {
+ return value;
+ }
+
+ switch (Cu.getClassName(value, true)) {
+ // Serialize arrays and ordinary objects as-is.
+ case "Array":
+ case "Object":
+ return value;
+
+ // Serialize Date objects and regular expressions as their
+ // string representations.
+ case "Date":
+ case "RegExp":
+ return String(value);
+ }
+ break;
+ }
+
+ if (!key) {
+ // If this is the root object, and we can't serialize it, serialize
+ // the value to an empty object.
+ return {};
+ }
+
+ // Everything else, omit entirely.
+ return undefined;
+}
+
+this.ExtensionStorage = {
+ cache: new Map(),
+ listeners: new Map(),
+
+ /**
+ * Sanitizes the given value, and returns a JSON-compatible
+ * representation of it, based on the privileges of the given global.
+ *
+ * @param {value} value
+ * The value to sanitize.
+ * @param {Context} context
+ * The extension context in which to sanitize the value
+ * @returns {value}
+ * The sanitized value.
+ */
+ sanitize(value, context) {
+ let json = context.jsonStringify(value, jsonReplacer);
+ return JSON.parse(json);
+ },
+
+ getExtensionDir(extensionId) {
+ return OS.Path.join(this.extensionDir, extensionId);
+ },
+
+ getStorageFile(extensionId) {
+ return OS.Path.join(this.extensionDir, extensionId, "storage.js");
+ },
+
+ read(extensionId) {
+ if (this.cache.has(extensionId)) {
+ return this.cache.get(extensionId);
+ }
+
+ let path = this.getStorageFile(extensionId);
+ let decoder = new TextDecoder();
+ let promise = OS.File.read(path);
+ promise = promise.then(array => {
+ return JSON.parse(decoder.decode(array));
+ }).catch((error) => {
+ if (!error.becauseNoSuchFile) {
+ Cu.reportError("Unable to parse JSON data for extension storage.");
+ }
+ return {};
+ });
+ this.cache.set(extensionId, promise);
+ return promise;
+ },
+
+ write(extensionId) {
+ let promise = this.read(extensionId).then(extData => {
+ let encoder = new TextEncoder();
+ let array = encoder.encode(JSON.stringify(extData));
+ let path = this.getStorageFile(extensionId);
+ OS.File.makeDir(this.getExtensionDir(extensionId), {
+ ignoreExisting: true,
+ from: OS.Constants.Path.profileDir,
+ });
+ let promise = OS.File.writeAtomic(path, array);
+ return promise;
+ }).catch(() => {
+ // Make sure this promise is never rejected.
+ Cu.reportError("Unable to write JSON data for extension storage.");
+ });
+
+ AsyncShutdown.profileBeforeChange.addBlocker(
+ "ExtensionStorage: Finish writing extension data",
+ promise);
+
+ return promise.then(() => {
+ AsyncShutdown.profileBeforeChange.removeBlocker(promise);
+ });
+ },
+
+ set(extensionId, items, context) {
+ return this.read(extensionId).then(extData => {
+ let changes = {};
+ for (let prop in items) {
+ let item = this.sanitize(items[prop], context);
+ changes[prop] = {oldValue: extData[prop], newValue: item};
+ extData[prop] = item;
+ }
+
+ this.notifyListeners(extensionId, changes);
+
+ return this.write(extensionId);
+ });
+ },
+
+ remove(extensionId, items) {
+ return this.read(extensionId).then(extData => {
+ let changes = {};
+ for (let prop of [].concat(items)) {
+ changes[prop] = {oldValue: extData[prop]};
+ delete extData[prop];
+ }
+
+ this.notifyListeners(extensionId, changes);
+
+ return this.write(extensionId);
+ });
+ },
+
+ clear(extensionId) {
+ return this.read(extensionId).then(extData => {
+ let changes = {};
+ for (let prop of Object.keys(extData)) {
+ changes[prop] = {oldValue: extData[prop]};
+ delete extData[prop];
+ }
+
+ this.notifyListeners(extensionId, changes);
+
+ return this.write(extensionId);
+ });
+ },
+
+ get(extensionId, keys) {
+ return this.read(extensionId).then(extData => {
+ let result = {};
+ if (keys === null) {
+ Object.assign(result, extData);
+ } else if (typeof(keys) == "object" && !Array.isArray(keys)) {
+ for (let prop in keys) {
+ if (prop in extData) {
+ result[prop] = extData[prop];
+ } else {
+ result[prop] = keys[prop];
+ }
+ }
+ } else {
+ for (let prop of [].concat(keys)) {
+ if (prop in extData) {
+ result[prop] = extData[prop];
+ }
+ }
+ }
+
+ return result;
+ });
+ },
+
+ addOnChangedListener(extensionId, listener) {
+ let listeners = this.listeners.get(extensionId) || new Set();
+ listeners.add(listener);
+ this.listeners.set(extensionId, listeners);
+ },
+
+ removeOnChangedListener(extensionId, listener) {
+ let listeners = this.listeners.get(extensionId);
+ listeners.delete(listener);
+ },
+
+ notifyListeners(extensionId, changes) {
+ let listeners = this.listeners.get(extensionId);
+ if (listeners) {
+ for (let listener of listeners) {
+ listener(changes);
+ }
+ }
+ },
+
+ init() {
+ if (Services.appinfo.processType != Services.appinfo.PROCESS_TYPE_DEFAULT) {
+ return;
+ }
+ Services.obs.addObserver(this, "extension-invalidate-storage-cache", false);
+ Services.obs.addObserver(this, "xpcom-shutdown", false);
+ },
+
+ observe(subject, topic, data) {
+ if (topic == "xpcom-shutdown") {
+ Services.obs.removeObserver(this, "extension-invalidate-storage-cache");
+ Services.obs.removeObserver(this, "xpcom-shutdown");
+ } else if (topic == "extension-invalidate-storage-cache") {
+ this.cache.clear();
+ }
+ },
+};
+
+XPCOMUtils.defineLazyGetter(ExtensionStorage, "extensionDir",
+ () => OS.Path.join(OS.Constants.Path.profileDir, "browser-extension-data"));
+
+ExtensionStorage.init();
diff --git a/toolkit/modules/UpdateUtils.jsm b/toolkit/modules/UpdateUtils.jsm
index 397f7e33a..5acf395d3 100644
--- a/toolkit/modules/UpdateUtils.jsm
+++ b/toolkit/modules/UpdateUtils.jsm
@@ -13,162 +13,86 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/NetUtil.jsm");
-Cu.import("resource://gre/modules/Preferences.jsm");
+#ifdef XP_WIN
Cu.import("resource://gre/modules/ctypes.jsm");
+Cu.import("resource://gre/modules/WindowsRegistry.jsm");
-const FILE_UPDATE_LOCALE = "update.locale";
+const WINREG_HKLM = Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE;
+const WINREG_WINNT = "Software\\Microsoft\\Windows NT\\CurrentVersion";
+#endif
const PREF_APP_DISTRIBUTION = "distribution.id";
const PREF_APP_DISTRIBUTION_VERSION = "distribution.version";
-const PREF_APP_B2G_VERSION = "b2g.version";
+const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
const PREF_APP_UPDATE_CUSTOM = "app.update.custom";
const PREF_APP_UPDATE_IMEI_HASH = "app.update.imei_hash";
-
+const PREF_LOCALE = "general.useragent.locale";
this.UpdateUtils = {
- /**
- * Read the update channel from defaults only. We do this to ensure that
- * the channel is tightly coupled with the application and does not apply
- * to other instances of the application that may use the same profile.
- *
- * @param [optional] aIncludePartners
- * Whether or not to include the partner bits. Default: true.
- */
- getUpdateChannel(aIncludePartners = true) {
- let defaults = Services.prefs.getDefaultBranch(null);
-#expand let channel = defaults.getCharPref("app.update.channel", "__MOZ_UPDATE_CHANNEL__");
-
- if (aIncludePartners) {
- try {
- let partners = Services.prefs.getChildList("app.partner.").sort();
- if (partners.length) {
- channel += "-cck";
- partners.forEach(function (prefName) {
- channel += "-" + Services.prefs.getCharPref(prefName);
- });
- }
- } catch (e) {
- Cu.reportError(e);
- }
- }
-
- return channel;
+ get UpdateChannel() {
+ return Services.prefs.getDefaultBranch(null)
+ .getCharPref(PREF_APP_UPDATE_CHANNEL, "@MOZ_UPDATE_CHANNEL@");
},
- get UpdateChannel() {
- return this.getUpdateChannel();
+ get Locale() {
+ return Services.prefs.getDefaultBranch(null)
+ .getCharPref(PREF_LOCALE, "en-US");
},
/**
* Formats a URL by replacing %...% values with OS, build and locale specific
* values.
*
- * @param url
+ * @param aUpdateURL
* The URL to format.
+ * @param aAdditionalSubsts
* @return The formatted URL.
*/
- formatUpdateURL(url) {
- url = url.replace(/%ID%/g, Services.appinfo.ID);
- url = url.replace(/%PRODUCT%/g, Services.appinfo.name);
- url = url.replace(/%VERSION%/g, Services.appinfo.version);
- url = url.replace(/%BUILD_ID%/g, Services.appinfo.appBuildID);
- url = url.replace(/%BUILD_TARGET%/g, Services.appinfo.OS + "_" + this.ABI);
- url = url.replace(/%BUILD_SPECIAL%/g, "@MOZ_PKG_SPECIAL@");
- url = url.replace(/%OS_VERSION%/g, this.OSVersion);
- url = url.replace(/%WIDGET_TOOLKIT%/g, "@MOZ_WIDGET_TOOLKIT@");
- url = url.replace(/%CHANNEL%/g, this.UpdateChannel);
-
- if (/%LOCALE%/.test(url)) {
- url = url.replace(/%LOCALE%/g, this.Locale);
+ formatUpdateURL: function(aUpdateURL, aAdditionalSubsts = null) {
+ // We want to be able to accept additional substs but also to have them be able to
+ // override the default ones below
+ if (aAdditionalSubsts) {
+ try {
+ aAdditionalSubsts.forEach(([_subst, _value]) => aUpdateURL = aUpdateURL.replace(_subst, _value));
+ } catch(ex) {
+ Cu.reportError(ex);
+ }
}
- url = url.replace(/%CUSTOM%/g, Preferences.get(PREF_APP_UPDATE_CUSTOM, ""));
- url = url.replace(/\+/g, "%2B");
-
- url = url.replace(/%SYSTEM_CAPABILITIES%/g, gSystemCapabilities);
- url = url.replace(/%PLATFORM_VERSION%/g, Services.appinfo.platformVersion);
- url = url.replace(/%DISTRIBUTION%/g,
- getDistributionPrefValue(PREF_APP_DISTRIBUTION));
- url = url.replace(/%DISTRIBUTION_VERSION%/g,
- getDistributionPrefValue(PREF_APP_DISTRIBUTION_VERSION));
-
- return url;
+ // appName SHOULD be lower case and not contain spaces even if it has in the past
+ let appName = Services.appinfo.name.replace(/\s+/g, '').toLowerCase()
+
+ // We want default pref values if they exist
+ let prefBranch = Services.prefs.getDefaultBranch(null)
+ let custom = prefBranch.getCharPref(PREF_APP_UPDATE_CUSTOM, "");
+ let distribution = prefBranch.getCharPref(PREF_APP_DISTRIBUTION, "default");
+ let distributionVersion = prefBranch.getCharPref(PREF_APP_DISTRIBUTION_VERSION, "default");
+
+ let substs = [
+ [/%ID%/g, Services.appinfo.ID],
+ [/%PRODUCT%/g, appName],
+ [/%VERSION%/g, Services.appinfo.version],
+ [/%BUILD_ID%/g, Services.appinfo.appBuildID],
+ [/%BUILD_TARGET%/g, Services.appinfo.OS + "_" + this.ABI],
+ [/%BUILD_SPECIAL%/g, "@MOZ_PKG_SPECIAL@"],
+ [/%OS_VERSION%/g, this.OSVersion],
+ [/%WIDGET_TOOLKIT%/g, "@MOZ_WIDGET_TOOLKIT@"],
+ [/%CHANNEL%/g, this.UpdateChannel],
+ [/%CUSTOM%/g, custom],
+ [/%PLATFORM_VERSION%/g, Services.appinfo.platformVersion],
+ [/%DISTRIBUTION%/g, distribution],
+ [/%DISTRIBUTION_VERSION%/g, distributionVersion],
+ [/%LOCALE%/g, this.Locale]
+ ];
+
+ substs.forEach(([_subst, _value]) => aUpdateURL = aUpdateURL.replace(_subst, _value));
+
+ // We do this last to make sure all pluses are converted
+ aUpdateURL = aUpdateURL.replace(/\+/g, "%2B");
+
+ return aUpdateURL;
}
};
-/* Get the distribution pref values, from defaults only */
-function getDistributionPrefValue(aPrefName) {
- return prefValue = Services.prefs.getDefaultBranch(null).getCharPref(aPrefName, "default");
-}
-
-/**
- * Gets the locale from the update.locale file for replacing %LOCALE% in the
- * update url. The update.locale file can be located in the application
- * directory or the GRE directory with preference given to it being located in
- * the application directory.
- */
-XPCOMUtils.defineLazyGetter(UpdateUtils, "Locale", function() {
- let channel;
- let locale;
- for (let res of ['app', 'gre']) {
- channel = NetUtil.newChannel({
- uri: "resource://" + res + "/" + FILE_UPDATE_LOCALE,
- contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_XMLHTTPREQUEST,
- loadUsingSystemPrincipal: true
- });
- try {
- let inputStream = channel.open2();
- locale = NetUtil.readInputStreamToString(inputStream, inputStream.available());
- } catch (e) {}
- if (locale)
- return locale.trim();
- }
-
- Cu.reportError(FILE_UPDATE_LOCALE + " file doesn't exist in either the " +
- "application or GRE directories");
-
- return null;
-});
-
-/**
- * Provides adhoc system capability information for application update.
- */
-XPCOMUtils.defineLazyGetter(this, "gSystemCapabilities", function aus_gSC() {
-#ifdef XP_WIN
- const PF_MMX_INSTRUCTIONS_AVAILABLE = 3; // MMX
- const PF_XMMI_INSTRUCTIONS_AVAILABLE = 6; // SSE
- const PF_XMMI64_INSTRUCTIONS_AVAILABLE = 10; // SSE2
- const PF_SSE3_INSTRUCTIONS_AVAILABLE = 13; // SSE3
-
- let lib = ctypes.open("kernel32.dll");
- let IsProcessorFeaturePresent = lib.declare("IsProcessorFeaturePresent",
- ctypes.winapi_abi,
- ctypes.int32_t, /* success */
- ctypes.uint32_t); /* DWORD */
- let instructionSet = "unknown";
- try {
- if (IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE)) {
- instructionSet = "SSE3";
- } else if (IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE)) {
- instructionSet = "SSE2";
- } else if (IsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE)) {
- instructionSet = "SSE";
- } else if (IsProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE)) {
- instructionSet = "MMX";
- }
- } catch (e) {
- instructionSet = "error";
- Cu.reportError("Error getting processor instruction set. " +
- "Exception: " + e);
- }
-
- lib.close();
- return instructionSet;
-#else
- return "NA"
-#endif
-});
-
#ifdef XP_WIN
/* Windows only getter that returns the processor architecture. */
XPCOMUtils.defineLazyGetter(this, "gWinCPUArch", function aus_gWinCPUArch() {
@@ -182,24 +106,24 @@ XPCOMUtils.defineLazyGetter(this, "gWinCPUArch", function aus_gWinCPUArch() {
// http://msdn.microsoft.com/en-us/library/ms724958%28v=vs.85%29.aspx
const SYSTEM_INFO = new ctypes.StructType('SYSTEM_INFO',
[
- {wProcessorArchitecture: WORD},
- {wReserved: WORD},
- {dwPageSize: DWORD},
- {lpMinimumApplicationAddress: ctypes.voidptr_t},
- {lpMaximumApplicationAddress: ctypes.voidptr_t},
- {dwActiveProcessorMask: DWORD.ptr},
- {dwNumberOfProcessors: DWORD},
- {dwProcessorType: DWORD},
- {dwAllocationGranularity: DWORD},
- {wProcessorLevel: WORD},
- {wProcessorRevision: WORD}
+ {wProcessorArchitecture: WORD},
+ {wReserved: WORD},
+ {dwPageSize: DWORD},
+ {lpMinimumApplicationAddress: ctypes.voidptr_t},
+ {lpMaximumApplicationAddress: ctypes.voidptr_t},
+ {dwActiveProcessorMask: DWORD.ptr},
+ {dwNumberOfProcessors: DWORD},
+ {dwProcessorType: DWORD},
+ {dwAllocationGranularity: DWORD},
+ {wProcessorLevel: WORD},
+ {wProcessorRevision: WORD}
]);
let kernel32 = false;
try {
kernel32 = ctypes.open("Kernel32");
- } catch (e) {
- Cu.reportError("Unable to open kernel32! Exception: " + e);
+ } catch (ex) {
+ Cu.reportError("Unable to open kernel32! Exception: " + ex);
}
if (kernel32) {
@@ -224,9 +148,9 @@ XPCOMUtils.defineLazyGetter(this, "gWinCPUArch", function aus_gWinCPUArch() {
arch = "x86";
break;
}
- } catch (e) {
+ } catch (ex) {
Cu.reportError("Error getting processor architecture. " +
- "Exception: " + e);
+ "Exception: " + ex);
} finally {
kernel32.close();
}
@@ -240,8 +164,7 @@ XPCOMUtils.defineLazyGetter(UpdateUtils, "ABI", function() {
let abi = null;
try {
abi = Services.appinfo.XPCOMABI;
- }
- catch (e) {
+ } catch (ex) {
Cu.reportError("XPCOM ABI unknown");
}
@@ -264,101 +187,34 @@ XPCOMUtils.defineLazyGetter(UpdateUtils, "OSVersion", function() {
try {
osVersion = Services.sysinfo.getProperty("name") + " " +
Services.sysinfo.getProperty("version");
- }
- catch (e) {
+ } catch(ex) {
Cu.reportError("OS Version unknown.");
}
#ifdef XP_WIN
if (osVersion) {
- const BYTE = ctypes.uint8_t;
- const WORD = ctypes.uint16_t;
- const DWORD = ctypes.uint32_t;
- const WCHAR = ctypes.char16_t;
- const BOOL = ctypes.int;
-
- // This structure is described at:
- // http://msdn.microsoft.com/en-us/library/ms724833%28v=vs.85%29.aspx
- const SZCSDVERSIONLENGTH = 128;
- const OSVERSIONINFOEXW = new ctypes.StructType('OSVERSIONINFOEXW',
- [
- {dwOSVersionInfoSize: DWORD},
- {dwMajorVersion: DWORD},
- {dwMinorVersion: DWORD},
- {dwBuildNumber: DWORD},
- {dwPlatformId: DWORD},
- {szCSDVersion: ctypes.ArrayType(WCHAR, SZCSDVERSIONLENGTH)},
- {wServicePackMajor: WORD},
- {wServicePackMinor: WORD},
- {wSuiteMask: WORD},
- {wProductType: BYTE},
- {wReserved: BYTE}
- ]);
-
- // This structure is described at:
- // http://msdn.microsoft.com/en-us/library/ms724958%28v=vs.85%29.aspx
- const SYSTEM_INFO = new ctypes.StructType('SYSTEM_INFO',
- [
- {wProcessorArchitecture: WORD},
- {wReserved: WORD},
- {dwPageSize: DWORD},
- {lpMinimumApplicationAddress: ctypes.voidptr_t},
- {lpMaximumApplicationAddress: ctypes.voidptr_t},
- {dwActiveProcessorMask: DWORD.ptr},
- {dwNumberOfProcessors: DWORD},
- {dwProcessorType: DWORD},
- {dwAllocationGranularity: DWORD},
- {wProcessorLevel: WORD},
- {wProcessorRevision: WORD}
- ]);
-
- let kernel32 = false;
- try {
- kernel32 = ctypes.open("Kernel32");
- } catch (e) {
- Cu.reportError("Unable to open kernel32! " + e);
- osVersion += ".unknown (unknown)";
+ let currentBuild = WindowsRegistry.readRegKey(WINREG_HKLM, WINREG_WINNT, "CurrentBuild");
+ let CSDBuildNumber = WindowsRegistry.readRegKey(WINREG_HKLM, WINREG_WINNT, "CSDBuildNumber");
+
+ if (!CSDBuildNumber) {
+ CSDBuildNumber = "0";
}
- if (kernel32) {
- try {
- // Get Service pack info
- try {
- let GetVersionEx = kernel32.declare("GetVersionExW",
- ctypes.default_abi,
- BOOL,
- OSVERSIONINFOEXW.ptr);
- let winVer = OSVERSIONINFOEXW();
- winVer.dwOSVersionInfoSize = OSVERSIONINFOEXW.size;
-
- if (0 !== GetVersionEx(winVer.address())) {
- osVersion += "." + winVer.wServicePackMajor +
- "." + winVer.wServicePackMinor;
- } else {
- Cu.reportError("Unknown failure in GetVersionEX (returned 0)");
- osVersion += ".unknown";
- }
- } catch (e) {
- Cu.reportError("Error getting service pack information. Exception: " + e);
- osVersion += ".unknown";
- }
- } finally {
- kernel32.close();
- }
+ osVersion = osVersion.replace(/Windows_NT/g, "WINNT");
+ osVersion += "." + currentBuild + "." + CSDBuildNumber
- // Add processor architecture
- osVersion += " (" + gWinCPUArch + ")";
- }
+ // Add processor architecture
+ osVersion += " (" + gWinCPUArch + ")";
}
+#endif
try {
osVersion += " (" + Services.sysinfo.getProperty("secondaryLibrary") + ")";
- }
- catch (e) {
+ } catch(ex) {
// Not all platforms have a secondary widget library, so an error is nothing to worry about.
}
+
osVersion = encodeURIComponent(osVersion);
-#endif
return osVersion;
});
diff --git a/toolkit/modules/moz.build b/toolkit/modules/moz.build
index 062388d24..0e8a4ee89 100644
--- a/toolkit/modules/moz.build
+++ b/toolkit/modules/moz.build
@@ -29,6 +29,7 @@ EXTRA_JS_MODULES += [
'debug.js',
'DeferredTask.jsm',
'Deprecated.jsm',
+ 'ExtensionStorage.jsm',
'FileUtils.jsm',
'Finder.jsm',
'FinderHighlighter.jsm',
diff --git a/toolkit/mozapps/installer/l10n-repack.py b/toolkit/mozapps/installer/l10n-repack.py
index 783c00b71..fcf3e773c 100644
--- a/toolkit/mozapps/installer/l10n-repack.py
+++ b/toolkit/mozapps/installer/l10n-repack.py
@@ -20,7 +20,6 @@ NON_CHROME = set([
'hyphenation',
'defaults/profile',
'defaults/pref*/*-l10n.js',
- 'update.locale',
'updater.ini',
'extensions/langpack-*@*',
'distribution/extensions/langpack-*@*',
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
index e3705a5c2..55072c474 100644
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -2781,19 +2781,26 @@ XREMain::XRE_mainInit(bool* aExitFlag)
#endif
SetupErrorHandling(gArgv[0]);
-
- // Set up environment for NSS DBM database
+ // Set up environment for NSS database choice
+#ifndef NSS_DISABLE_DBM
// Allow iteration counts in DBM mode
SaveToEnv("NSS_ALLOW_LEGACY_DBM_ITERATION_COUNT=1");
- // Set default Master Password rounds to a sane value for DBM which is slower
- // than SQL for PBKDF. The NSS hard-coded default of 10,000 is too much.
- // See also Bug 1606992 for perf issues.
+#endif
+
#ifdef DEBUG
+ // Reduce the number of rounds for debug builds for perf/test reasons.
SaveToEnv("NSS_MAX_MP_PBE_ITERATION_COUNT=15");
#else
+#ifdef MOZ_SECURITY_SQLSTORE
+ // We're using SQL; NSS's defaults for rounds are fine.
+#else
+ // Set default Master Password rounds to a sane value for DBM which is slower
+ // than SQL for PBKDF. The NSS hard-coded default of 10,000 is too much.
+ // See also Bug 1606992 for perf issues.
SaveToEnv("NSS_MAX_MP_PBE_ITERATION_COUNT=500");
#endif
+#endif
#ifdef CAIRO_HAS_DWRITE_FONT
{