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
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
7 import { NetUtil } from "resource://gre/modules/NetUtil.sys.mjs";
9 export function MozProtocolHandler() {
10 XPCOMUtils.defineLazyPreferenceGetter(
13 "toolkit.mozprotocol.url",
14 "https://www.mozilla.org/about/manifesto/"
18 MozProtocolHandler.prototype = {
21 protocolFlags: Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD,
23 newChannel(uri, loadInfo) {
24 const kCanada = "https://www.mozilla.org/contact/communities/canada/";
25 let realURL = NetUtil.newURI(
26 uri && uri.spec == "moz://eh" ? kCanada : this.urlToLoad
28 let channel = Services.io.newChannelFromURIWithLoadInfo(realURL, loadInfo);
29 loadInfo.resultPrincipalURI = realURL;
33 QueryInterface: ChromeUtils.generateQI(["nsIProtocolHandler"]),