summaryrefslogtreecommitdiff
path: root/common/content/io.js
diff options
context:
space:
mode:
authorKris Maglione <maglione.k@gmail.com>2010-12-16 02:03:22 -0500
committerKris Maglione <maglione.k@gmail.com>2010-12-16 02:03:22 -0500
commit011a7edd299c4146a4837cbded856ffc51db992b (patch)
treeece1ff780611edbce53339fc8f405849f2c34c54 /common/content/io.js
parentb1331b689d9a7f99be60fbd93d6ec3787ae55fcd (diff)
downloadpentadactyl-011a7edd299c4146a4837cbded856ffc51db992b.tar.gz
Minor chrome: URI completion bug fixes.
Diffstat (limited to 'common/content/io.js')
-rw-r--r--common/content/io.js19
1 files changed, 8 insertions, 11 deletions
diff --git a/common/content/io.js b/common/content/io.js
index 09b19659..70c17424 100644
--- a/common/content/io.js
+++ b/common/content/io.js
@@ -215,7 +215,7 @@ const IO = Module("io", {
let channel = services.io.newChannelFromURI(uri);
channel.cancel(Cr.NS_BINDING_ABORTED);
if (channel instanceof Ci.nsIJARChannel)
- return channel.QueryInterface(Ci.nsIJARChannel);
+ return channel.URI.QueryInterface(Ci.nsIJARURI);
}
catch (e) {}
return false;
@@ -670,7 +670,7 @@ lookup:
dir = getDir(dir || context.filter);
let file = util.getFile(dir);
- if (file && file.exists() && !file.isDirectory())
+ if (file && (!file.exists() || !file.isDirectory()))
file = file.parent;
if (!full)
@@ -694,22 +694,22 @@ lookup:
// context.background = true;
context.key = dir;
- let channel = io.isJarURL(dir);
- if (channel)
+ let uri = io.isJarURL(dir);
+ if (uri)
context.generate = function generate_jar() {
- let uri = channel.URI.QueryInterface(Ci.nsIJARURI);
let file = util.getFile(uri.JARFile);
if (file) {
// let jar = services.zipReader.getZip(file); Crashes.
let jar = services.ZipReader(file);
try {
- let path = decodeURI(getDir(uri.JAREntry));
+ let filter = RegExp("^" + util.regexp.escape(decodeURI(getDir(uri.JAREntry)))
+ + "[^/]*/?$");
return [
{
isDirectory: function () s.substr(-1) == "/",
leafName: /([^\/]*)\/?$/.exec(s)[1]
}
- for (s in iter(jar.findEntries("*"))) if (s.indexOf(path) == 0)
+ for (s in iter(jar.findEntries("*"))) if (filter.test(s))
]
}
finally {
@@ -720,12 +720,9 @@ lookup:
else
context.generate = function generate_file() {
try {
- util.dump(String(file), file && file.path);
return io.File(file || dir).readDirectory();
}
- catch (e) {
- util.reportError(e);
- }
+ catch (e) {}
return [];
};
};