Access hints_default_object_classes and hints_xpath_expressions as buffer-local variables
[conkeror.git] / modules / mime.js
blob5aecee3166e72f40ef5ab05ebd38ddfe8cd4949b
3 const mime_service = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
5 var mime_type_external_handlers = [
7     [ /^text\/.*$/, getenv("EDITOR")],
8     [/^image\/.*$/, "feh"],
9     [/^video\/.*$/, "mplayer"],
10     [/^audio\/.*$/, "mplayer"],
11     [/^application\/pdf$/, "evince"],
12     [/^application\/postscript$/, "evince"],
13     [/^application\/x-dvi$/, "evince"],
14     [/^.*$/, getenv("EDITOR")]
15     ];
17 function get_external_handler_for_mime_type(mime_type) {
18     return predicate_alist_match(mime_type);
21 function mime_type_from_url(url) {
22     var type = "application/octet-stream";
23     try {
24         url = make_uri(url);
25         type = mime_service.getTypeFromURI(url);
26     } catch (e) {}
27     return type;
30 function mime_info_from_mime_type(type) {
31     if (type == null)
32         type = "application/octet-stream";
33     try {
34         return mime_service.getFromTypeAndExtension(type, null);
35     } catch (e) {
36         return null;
37     }