|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
|
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 "use strict"; |
|
6 |
|
7 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; |
|
8 |
|
9 Cu.import('resource://gre/modules/XPCOMUtils.jsm'); |
|
10 |
|
11 XPCOMUtils.defineLazyServiceGetter(this, "cpmm", |
|
12 "@mozilla.org/childprocessmessagemanager;1", |
|
13 "nsIMessageSender"); |
|
14 |
|
15 function MailtoProtocolHandler() { |
|
16 } |
|
17 |
|
18 MailtoProtocolHandler.prototype = { |
|
19 |
|
20 scheme: "mailto", |
|
21 defaultPort: -1, |
|
22 protocolFlags: Ci.nsIProtocolHandler.URI_NORELATIVE | |
|
23 Ci.nsIProtocolHandler.URI_NOAUTH | |
|
24 Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE | |
|
25 Ci.nsIProtocolHandler.URI_DOES_NOT_RETURN_DATA, |
|
26 allowPort: function() false, |
|
27 |
|
28 newURI: function Proto_newURI(aSpec, aOriginCharset) { |
|
29 let uri = Cc["@mozilla.org/network/simple-uri;1"].createInstance(Ci.nsIURI); |
|
30 uri.spec = aSpec; |
|
31 return uri; |
|
32 }, |
|
33 |
|
34 newChannel: function Proto_newChannel(aURI) { |
|
35 cpmm.sendAsyncMessage("mail-handler", { |
|
36 URI: aURI.spec, |
|
37 type: "mail" }); |
|
38 |
|
39 throw Components.results.NS_ERROR_ILLEGAL_VALUE; |
|
40 }, |
|
41 |
|
42 classID: Components.ID("{50777e53-0331-4366-a191-900999be386c}"), |
|
43 QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler]) |
|
44 }; |
|
45 |
|
46 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([MailtoProtocolHandler]); |