michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: "use strict"; michael@0: michael@0: const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; michael@0: michael@0: Cu.import('resource://gre/modules/XPCOMUtils.jsm'); michael@0: michael@0: XPCOMUtils.defineLazyServiceGetter(this, "cpmm", michael@0: "@mozilla.org/childprocessmessagemanager;1", michael@0: "nsIMessageSender"); michael@0: michael@0: function MailtoProtocolHandler() { michael@0: } michael@0: michael@0: MailtoProtocolHandler.prototype = { michael@0: michael@0: scheme: "mailto", michael@0: defaultPort: -1, michael@0: protocolFlags: Ci.nsIProtocolHandler.URI_NORELATIVE | michael@0: Ci.nsIProtocolHandler.URI_NOAUTH | michael@0: Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE | michael@0: Ci.nsIProtocolHandler.URI_DOES_NOT_RETURN_DATA, michael@0: allowPort: function() false, michael@0: michael@0: newURI: function Proto_newURI(aSpec, aOriginCharset) { michael@0: let uri = Cc["@mozilla.org/network/simple-uri;1"].createInstance(Ci.nsIURI); michael@0: uri.spec = aSpec; michael@0: return uri; michael@0: }, michael@0: michael@0: newChannel: function Proto_newChannel(aURI) { michael@0: cpmm.sendAsyncMessage("mail-handler", { michael@0: URI: aURI.spec, michael@0: type: "mail" }); michael@0: michael@0: throw Components.results.NS_ERROR_ILLEGAL_VALUE; michael@0: }, michael@0: michael@0: classID: Components.ID("{50777e53-0331-4366-a191-900999be386c}"), michael@0: QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler]) michael@0: }; michael@0: michael@0: this.NSGetFactory = XPCOMUtils.generateNSGetFactory([MailtoProtocolHandler]);