diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 018f32d8..8506b7d9 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -1319,6 +1319,8 @@ const Dactyl = Module("dactyl", { let dialog = args[0]; dactyl.assert(dialog in config.dialogs, "E475: Invalid argument: " + dialog); + dactyl.assert(!config.dialogs[dialog][2] || config.dialogs[dialog][2](), + "Dialog " + dialog + " not available"); try { config.dialogs[dialog][1](); } @@ -1916,7 +1918,8 @@ const Dactyl = Module("dactyl", { completion: function () { completion.dialog = function dialog(context) { context.title = ["Dialog"]; - context.completions = [[k, v[0]] for ([k, v] in Iterator(config.dialogs))]; + context.filters.push(function ({ item }) !item[2] || item[2]()); + context.completions = [[k, v[0], v[2]] for ([k, v] in Iterator(config.dialogs))]; }; completion.extension = function extension(context) { diff --git a/pentadactyl/content/config.js b/pentadactyl/content/config.js index 120b3a07..9631986e 100644 --- a/pentadactyl/content/config.js +++ b/pentadactyl/content/config.js @@ -46,7 +46,8 @@ const Config = Module("config", ConfigBase, { bookmarks: ["List your bookmarks", function () { window.openDialog("chrome://browser/content/bookmarks/bookmarksPanel.xul", "Bookmarks", "dialog,centerscreen,width=600,height=600"); }], checkupdates: ["Check for updates", - function () { window.checkForUpdates(); }], + function () { window.checkForUpdates(); }, + function () "checkForUpdates" in window], cleardata: ["Clear private data", function () { Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIBrowserGlue).sanitize(window || null); }], cookies: ["List your cookies", @@ -56,7 +57,8 @@ const Config = Module("config", ConfigBase, { customizetoolbar: ["Customize the Toolbar", function () { window.BrowserCustomizeToolbar(); }], dominspector: ["DOM Inspector", - function () { try { window.inspectDOMDocument(content.document); } catch (e) { dactyl.echoerr("DOM Inspector extension not installed"); } }], + function () { window.inspectDOMDocument(content.document); }, + function () "inspectDOMDocument" in window], downloads: ["Manage Downloads", function () { window.toOpenWindowByType("Download:Manager", "chrome://mozapps/content/downloads/downloads.xul", "chrome,dialog=no,resizable"); }], history: ["List your history", @@ -90,7 +92,8 @@ const Config = Module("config", ConfigBase, { selectionsource: ["View selection source", function () { buffer.viewSelectionSource(); }], venkman: ["The JavaScript debugger", - function () { dactyl.assert("start_venkman" in window, "Venkman is not installed"); start_venkman() }] + function () { dactyl.assert("start_venkman" in window, "Venkman is not installed"); start_venkman() }, + function () "start_venkman" in window] }, features: [