1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-07 17:24:13 +01:00

Better temp file names for gF and friends.

This commit is contained in:
Kris Maglione
2011-10-06 02:22:50 -04:00
parent adea42d882
commit 4bc779fe7c
4 changed files with 10 additions and 8 deletions

View File

@@ -1016,6 +1016,9 @@ var Buffer = Module("Buffer", {
};
let uri = isString(doc) ? util.newURI(doc) : util.newURI(doc.location.href);
let ext = uri.fileExtension || "txt";
if (doc.contentType)
ext = services.mime.getPrimaryExtension(doc.contentType, ext);
if (!isString(doc))
return io.withTempFiles(function (temp) {
@@ -1023,7 +1026,7 @@ var Buffer = Module("Buffer", {
encoder.init(doc, "text/unicode", encoder.OutputRaw|encoder.OutputPreformatted);
temp.write(encoder.encodeToString(), ">");
return this.callback(temp, true);
}, this, true);
}, this, true, ext);
let file = util.getFile(uri);
if (file)