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/. */
8 * This file implements the URLs for Telephone Calls
9 * https://www.ietf.org/rfc/rfc2806.txt
14 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
16 Cu.import('resource://gre/modules/XPCOMUtils.jsm');
17 Cu.import("resource:///modules/TelURIParser.jsm");
19 XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
20 "@mozilla.org/childprocessmessagemanager;1",
23 function TelProtocolHandler() {
26 TelProtocolHandler.prototype = {
30 protocolFlags: Ci.nsIProtocolHandler.URI_NORELATIVE |
31 Ci.nsIProtocolHandler.URI_NOAUTH |
32 Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE |
33 Ci.nsIProtocolHandler.URI_DOES_NOT_RETURN_DATA,
34 allowPort: function() false,
36 newURI: function Proto_newURI(aSpec, aOriginCharset) {
37 let uri = Cc["@mozilla.org/network/simple-uri;1"].createInstance(Ci.nsIURI);
42 newChannel: function Proto_newChannel(aURI) {
43 let number = TelURIParser.parseURI('tel', aURI.spec);
46 cpmm.sendAsyncMessage("dial-handler", {
48 type: "webtelephony/number" });
51 throw Components.results.NS_ERROR_ILLEGAL_VALUE;
54 classID: Components.ID("{782775dd-7351-45ea-aff1-0ffa872cfdd2}"),
55 QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler])
58 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TelProtocolHandler]);