Bug 1391488 - catch and ignore errors fetching the hostname from the DNS service. r?kitcambridge
MozReview-Commit-ID: 5hTDNmzTXdQ
--- a/services/sync/modules/util.js
+++ b/services/sync/modules/util.js
@@ -573,21 +573,29 @@ this.Utils = {
if (user == "%USERNAME%" && env.get("USERNAME")) {
user = env.get("USERNAME");
}
let brand = Services.strings.createBundle(
"chrome://branding/locale/brand.properties");
let brandName = brand.GetStringFromName("brandShortName");
+ // The DNS service may fail to provide a hostname in edge-cases we don't
+ // fully understand - bug 1391488.
+ let hostname;
+ try {
+ // hostname of the system, usually assigned by the user or admin
+ hostname = Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService).myHostName;
+ } catch (ex) {
+ Cu.reportError(ex);
+ }
let system =
// 'device' is defined on unix systems
Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2).get("device") ||
- // hostname of the system, usually assigned by the user or admin
- Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService).myHostName ||
+ hostname ||
// fall back on ua info string
Cc["@mozilla.org/network/protocol;1?name=http"].getService(Ci.nsIHttpProtocolHandler).oscpu;
let syncStrings = Services.strings.createBundle("chrome://weave/locale/sync.properties");
return syncStrings.formatStringFromName("client.name2", [user, brandName, system], 3);
},
getDeviceName() {