summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/content/commandline.js29
-rw-r--r--common/content/dactyl.js2
-rw-r--r--common/modules/bootstrap.jsm2
-rw-r--r--common/modules/downloads.jsm2
-rw-r--r--common/modules/services.jsm18
-rw-r--r--common/modules/template.jsm5
6 files changed, 32 insertions, 26 deletions
diff --git a/common/content/commandline.js b/common/content/commandline.js
index 6ef6f71c..02187d14 100644
--- a/common/content/commandline.js
+++ b/common/content/commandline.js
@@ -21,6 +21,9 @@ var CommandWidgets = Class("CommandWidgets", {
<menuitem id="dactyl-context-copylink"
label="Copy Link Location" dactyl:group="link"
oncommand="goDoCommand('cmd_copyLink');"/>
+ <menuitem id="dactyl-context-copypath"
+ label="Copy File Path" dactyl:group="link path"
+ oncommand="dactyl.clipboardWrite(document.popupNode.getAttribute('path'));"/>
<menuitem id="dactyl-context-copy"
label="Copy" dactyl:group="selection"
command="cmd_copy"/>
@@ -937,14 +940,21 @@ var CommandLine = Module("commandline", {
},
onContext: function onContext(event) {
- let enabled = {
- link: window.document.popupNode instanceof HTMLAnchorElement,
- selection: !window.document.commandDispatcher.focusedWindow.getSelection().isCollapsed
- };
-
- for (let [, node] in iter(event.target.childNodes)) {
- let group = node.getAttributeNS(NS, "group");
- node.hidden = group && !group.split(/\s+/).some(function (g) enabled[g]);
+ try {
+ let enabled = {
+ link: window.document.popupNode instanceof HTMLAnchorElement,
+ path: window.document.popupNode.hasAttribute("path"),
+ selection: !window.document.commandDispatcher.focusedWindow.getSelection().isCollapsed
+ };
+
+ for (let node in array.iterValues(event.target.children)) {
+ let group = node.getAttributeNS(NS, "group");
+ util.dump(node, group, group && !group.split(/\s+/).every(function (g) enabled[g]));
+ node.hidden = group && !group.split(/\s+/).every(function (g) enabled[g]);
+ }
+ }
+ catch (e) {
+ util.reportError(e);
}
return true;
},
@@ -1100,6 +1110,9 @@ var CommandLine = Module("commandline", {
event.originalTarget.hasAttributeNS(NS, "command"))) {
let command = event.originalTarget.getAttributeNS(NS, "command");
+ if (command && event.button == 2)
+ return PASS;
+
if (command && dactyl.commands[command]) {
event.preventDefault();
return dactyl.withSavedValues(["forceNewTab"], function () {
diff --git a/common/content/dactyl.js b/common/content/dactyl.js
index 5e706e7e..e454e1b0 100644
--- a/common/content/dactyl.js
+++ b/common/content/dactyl.js
@@ -363,7 +363,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
userEval: function (str, context, fileName, lineNumber) {
if (jsmodules.__proto__ != window)
- str = "with (window) { with (modules) { this.eval(" + str.quote() + ") } }";
+ str = "with (window) { with (modules) { (this.eval || eval)(" + str.quote() + ") } }";
if (fileName == null)
if (io.sourcing && io.sourcing.file[0] !== "[")
diff --git a/common/modules/bootstrap.jsm b/common/modules/bootstrap.jsm
index 4149828a..658fbafa 100644
--- a/common/modules/bootstrap.jsm
+++ b/common/modules/bootstrap.jsm
@@ -4,8 +4,6 @@
// given in the LICENSE.txt file included with this file.
"use strict";
-dump(" ======================= bootstrap.jsm " + (typeof JSMLoader) + " ======================= \n");
-
var EXPORTED_SYMBOLS = ["JSMLoader"];
let global = this;
diff --git a/common/modules/downloads.jsm b/common/modules/downloads.jsm
index 1e24d1cc..73d69f26 100644
--- a/common/modules/downloads.jsm
+++ b/common/modules/downloads.jsm
@@ -29,7 +29,7 @@ var Download = Class("Download", {
<li highlight="Download" key="row" xmlns:dactyl={NS} xmlns={XHTML}>
<span highlight="DownloadTitle">
<span highlight="Link">
- <a key="title" href={self.target.spec}>{self.displayName}</a>
+ <a key="title" href={self.target.spec} path={self.targetFile.path}>{self.displayName}</a>
<span highlight="LinkInfo">{self.targetFile.path}</span>
</span>
</span>
diff --git a/common/modules/services.jsm b/common/modules/services.jsm
index 5d1bc915..74cac15e 100644
--- a/common/modules/services.jsm
+++ b/common/modules/services.jsm
@@ -114,10 +114,11 @@ var Services = Module("Services", {
}
["aboutURL", "creator", "description", "developers",
- "homepageURL", "iconURL", "installDate",
- "optionsURL", "releaseNotesURI", "updateDate", "version"].forEach(function (item) {
- addon[item] = getRdfProperty(addon, item);
+ "homepageURL", "installDate", "optionsURL",
+ "releaseNotesURI", "updateDate"].forEach(function (item) {
+ memoize(addon, item, function (item) getRdfProperty(this, item));
});
+
update(addon, {
appDisabled: false,
@@ -148,7 +149,7 @@ var Services = Module("Services", {
for (let [, item] in Iterator(services.extensionManager
.getItemList(Ci.nsIUpdateItem["TYPE_" + type.toUpperCase()], {})))
res.push(this.getAddonByID(item));
- callback(res);
+ return (callback || util.identity)(res);
},
getInstallForFile: function (file, callback, mimetype) {
callback({
@@ -207,14 +208,7 @@ var Services = Module("Services", {
const self = this;
if (name in this && ifaces && !this.__lookupGetter__(name) && !(this[name] instanceof Ci.nsISupports))
throw TypeError();
- this.__defineGetter__(name, function () {
- let res = self._create(class_, ifaces, meth);
- if (!res)
- return null;
-
- delete this[name];
- return this[name] = res;
- });
+ memoize(this, name, function () self._create(class_, ifaces, meth));
},
/**
diff --git a/common/modules/template.jsm b/common/modules/template.jsm
index 53aaf216..e5ae693b 100644
--- a/common/modules/template.jsm
+++ b/common/modules/template.jsm
@@ -262,12 +262,13 @@ var Template = Module("Template", {
sourceLink: function (frame) {
let url = (frame.filename || "unknown").replace(/.* -> /, "");
+ let path = util.urlPath(url);
XML.ignoreWhitespace = false; XML.prettyPrinting = false;
return <a xmlns:dactyl={NS} dactyl:command="buffer.viewSource"
- href={url} line={frame.lineNumber}
+ href={url} path={path} line={frame.lineNumber}
highlight="URL">{
- util.urlPath(url) + ":" + frame.lineNumber
+ path + ":" + frame.lineNumber
}</a>
},