diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js index aa2cb797..094cc351 100644 --- a/common/content/bookmarks.js +++ b/common/content/bookmarks.js @@ -364,11 +364,11 @@ const Bookmarks = Module("bookmarks", { return dactyl.open(items.map(function (i) i.url), dactyl.NEW_TAB); if (filter.length > 0 && tags.length > 0) - dactyl.echoerr("E283: No bookmarks matching tags: " + tags.quote() + " and string: " + filter.quote()); + dactyl.echoerr("E283: No bookmarks matching tags: " + tags.map(String.quote) + " and string: " + filter.quote()); else if (filter.length > 0) dactyl.echoerr("E283: No bookmarks matching string: " + filter.quote()); else if (tags.length > 0) - dactyl.echoerr("E283: No bookmarks matching tags: " + tags.quote()); + dactyl.echoerr("E283: No bookmarks matching tags: " + tags.map(String.quote)); else dactyl.echoerr("No bookmarks set"); return null; diff --git a/common/content/buffer.js b/common/content/buffer.js index 6f797f84..38f5a422 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -494,6 +494,8 @@ const Buffer = Module("buffer", { * @returns {boolean} */ focusAllowed: function (elem) { + if (elem instanceof Window && !Editor.getEditor(window)) + return true; let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem; return !options["strictfocus"] || win.dactylFocusAllowed; }, @@ -811,52 +813,34 @@ const Buffer = Module("buffer", { * @param {number} count The number of frames to skip through. * @param {boolean} forward The direction of motion. */ - shiftFrameFocus: function (count, forward) { + shiftFrameFocus: function (count) { if (!(window.content.document instanceof HTMLDocument)) return; - count = Math.max(count, 1); let frames = buffer.allFrames(); if (frames.length == 0) // currently top is always included return; - // remove all unfocusable frames - // TODO: find a better way to do this - walking the tree is too slow - let start = document.commandDispatcher.focusedWindow; - frames = frames.filter(function (frame) { - frame.focus(); - return document.commandDispatcher.focusedWindow == frame; - }); - start.focus(); + // remove all hidden frames + frames = frames.filter(function (frame) !(frame.document.body instanceof HTMLFrameSetElement)) + .filter(function (frame) !frame.frameElement || + let (rect = frame.frameElement.getBoundingClientRect()) + rect.width && rect.height); // find the currently focused frame index // TODO: If the window is a frameset then the first _frame_ should be // focused. Since this is not the current FF behavior, // we initialize current to -1 so the first call takes us to the // first frame. - let current = frames.indexOf(document.commandDispatcher.focusedWindow); + let current = Math.max(0, frames.indexOf(buffer.focusedFrame)); // calculate the next frame to focus - let next = current; - if (forward) { - next = current + count; - - if (next > frames.length - 1) { - if (current == frames.length - 1) - dactyl.beep(); - next = frames.length - 1; // still allow the frame indicator to be activated - } - } - else { - next = current - count; - - if (next < 0) { - if (current == 0) - dactyl.beep(); - next = 0; // still allow the frame indicator to be activated - } - } + let next = current + count; + if (next < 0 || next >= frames.length) + dactyl.beep(); + next = Math.constrain(next, 0, frames.length - 1); + util.dump(current, count, next, String(frames[next])); // focus next frame and scroll into view frames[next].focus(); @@ -866,7 +850,7 @@ const Buffer = Module("buffer", { // add the frame indicator let doc = frames[next].document; let indicator = util.xmlToDom(
, doc); - doc.body.appendChild(indicator); + (doc.body || doc.documentElement || doc).appendChild(indicator); util.timeout(function () { doc.body.removeChild(indicator); }, 500); @@ -1586,12 +1570,12 @@ const Buffer = Module("buffer", { mappings.add(myModes, ["]f"], "Focus next frame", - function (count) { buffer.shiftFrameFocus(Math.max(count, 1), true); }, + function (count) { buffer.shiftFrameFocus(Math.max(count, 1)); }, { count: true }); mappings.add(myModes, ["[f"], "Focus previous frame", - function (count) { buffer.shiftFrameFocus(Math.max(count, 1), false); }, + function (count) { buffer.shiftFrameFocus(-Math.max(count, 1)); }, { count: true }); mappings.add(myModes, ["]]"], diff --git a/common/content/dactyl.js b/common/content/dactyl.js index f4c33efe..758304f6 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -150,7 +150,7 @@ const Dactyl = Module("dactyl", { } else { highlight.highlightNode(document.documentElement, "Bell"); - util.timeout(function () { document.documentElement.removeAttributeNS(NS, "highlight"); }, 20); + util.timeout(function () { document.documentElement.removeAttributeNS(NS, "highlight"); }, 5); } } else { @@ -1268,7 +1268,7 @@ const Dactyl = Module("dactyl", { } }); - options.add(["urlseparator", "us"], + options.add(["urlseparator", "urlsep", "us"], "Set the separator regexp used to separate multiple URL args", "string", "\\|"); diff --git a/common/content/help.xsl b/common/content/help.xsl index 908ae3ec..8f4cfa69 100644 --- a/common/content/help.xsl +++ b/common/content/help.xsl @@ -233,7 +233,7 @@ (default:Defines specialized XPath expressions for arbitrary @@ -796,7 +796,7 @@
The regular expression used to split URL lists in commands diff --git a/common/modules/sanitizer.jsm b/common/modules/sanitizer.jsm index 24422504..7b84799b 100644 --- a/common/modules/sanitizer.jsm +++ b/common/modules/sanitizer.jsm @@ -166,7 +166,7 @@ const Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakR } - }, + } })); } let (branch = Item.PREFIX + Item.BRANCH) { @@ -328,14 +328,18 @@ const Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakR prefToArg: function (pref) pref.replace(/.*\./, "").toLowerCase(), iterCookies: function iterCookies(host) { - for (let c in iter(services.get("cookies"))) - if (c.QueryInterface(Ci.nsICookie2) && !host || util.isSubdomain(c.rawHost, host)) + for (let c in iter(services.get("cookies"))) { + c.QueryInterface(Ci.nsICookie2); + if (!host || util.isSubdomain(c.rawHost, host)) yield c; + } }, iterPermissions: function iterPermissions(host) { - for (let p in iter(services.get("permissions"))) - if (p.QueryInterface(Ci.nsIPermission) && (!host || util.isSubdomain(p.host, host))) + for (let p in iter(services.get("permissions"))) { + p.QueryInterface(Ci.nsIPermission); + if (!host || util.isSubdomain(p.host, host)) yield p; + } } }, { load: function (dactyl, modules, window) { @@ -443,7 +447,7 @@ const Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakR services.get("permissions").add(uri, "cookie", Sanitizer.PERMS[perm]); } commands.add(["cookies", "ck"], - "Change cookie permissions for sites.", + "Change cookie permissions for sites", function (args) { let host = args.shift(); let session = true;