diff --git a/common/content/commands.js b/common/content/commands.js index 4e091f19..cf704727 100644 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -912,9 +912,9 @@ const Commands = Module("commands", { } // dynamically get completions as specified with the command's completer function + context.highlight(); let command = cmd && commands.get(cmd); if (!command) { - context.highlight(); context.highlight(0, cmd && cmd.length, "SPELLCHECK"); return; } diff --git a/common/modules/storage.jsm b/common/modules/storage.jsm index 453918b3..68a8448f 100644 --- a/common/modules/storage.jsm +++ b/common/modules/storage.jsm @@ -264,11 +264,12 @@ const Storage = Module("Storage", { }, { }, { init: function (dactyl, modules) { - let infoPath = services.create("file"); - infoPath.initWithPath(File.expandPath(modules.IO.runtimePath.replace(/,.*/, ""))); - infoPath.append("info"); - infoPath.append(dactyl.profileName); - storage.infoPath = infoPath; + let infoPath = File(modules.IO.runtimePath.replace(/,.*/, "")); + if (infoPath) { + infoPath.append("info"); + infoPath.append(dactyl.profileName); + storage.infoPath = infoPath; + } } }); @@ -289,12 +290,18 @@ const File = Class("File", { else if (/file:\/\//.test(path)) file = services.create("file:").getFileFromURLSpec(path); else { - let expandedPath = File.expandPath(path); + try { + let expandedPath = File.expandPath(path); - if (!File.isAbsolutePath(expandedPath) && checkPWD) - file = File.joinPaths(checkPWD, expandedPath); - else - file.initWithPath(expandedPath); + if (!File.isAbsolutePath(expandedPath) && checkPWD) + file = File.joinPaths(checkPWD, expandedPath); + else + file.initWithPath(expandedPath); + } + catch (e) { + dump("dactyl: " + e + "\n" + String.replace(e.stack, /^/gm, "dactyl: ") + "\n"); + return null; + } } let self = XPCSafeJSObjectWrapper(file); self.__proto__ = File.prototype; @@ -510,7 +517,7 @@ const File = Class("File", { let home = services.get("environment").get("HOME"); // Windows has its own idiosyncratic $HOME variables. - if (!home && win32) + if (win32 && (!home || !File(home) || !File(home).exists())) home = services.get("environment").get("USERPROFILE") || services.get("environment").get("HOMEDRIVE") + services.get("environment").get("HOMEPATH");