possibly_valid_url: allow spaces after first '/'
[conkeror/arlinius.git] / modules / minibuffer-read-mime-type.js
blob6622c7178950cd430e2c34928409888d36e38a3d
1 /**
2  * (C) Copyright 2008 Jeremy Maitin-Shepard
3  *
4  * Use, modification, and distribution are subject to the terms specified in the
5  * COPYING file.
6 **/
8 require("minibuffer-read.js");
10 let _viewable_mime_type_list = null;
12 __defineGetter__("viewable_mime_type_list",
13     function () {
14         if (_viewable_mime_type_list == null) {
15             let list = [];
16             var en = category_manager
17                 .enumerateCategory("Gecko-Content-Viewers");
18             while (en.hasMoreElements())
19                 list.push(en.getNext()
20                             .QueryInterface(Ci.nsISupportsCString)
21                             .toString());
22             _viewable_mime_type_list = list;
23         }
24         return _viewable_mime_type_list;
25     });
27 var category_manager = Cc["@mozilla.org/categorymanager;1"]
28     .getService(Ci.nsICategoryManager);
30 minibuffer.prototype.read_viewable_mime_type = function () {
31     var result = yield this.read(
32         forward_keywords(arguments),
33         $completer = prefix_completer(
34             $completions = viewable_mime_type_list),
35         $match_required,
36         $space_completes);
37     yield co_return(result);
40 provide("minibuffer-read-mime-type");