b2g/components/MailtoProtocolHandler.js

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

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

mercurial