1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
2 * vim: sw=2 ts=2 sts=2 expandtab
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 const EXPORTED_SYMBOLS = ["AboutPagesUtils"];
11 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
12 const { XPCOMUtils } = ChromeUtils.import(
13 "resource://gre/modules/XPCOMUtils.jsm"
16 const AboutPagesUtils = {};
18 XPCOMUtils.defineLazyGetter(AboutPagesUtils, "visibleAboutUrls", () => {
20 const rx = /@mozilla.org\/network\/protocol\/about;1\?what\=(.*)$/;
21 for (const cid in Cc) {
22 const result = cid.match(rx);
26 const [, aboutType] = result;
28 const am = Cc[cid].getService(Ci.nsIAboutModule);
29 const uri = Services.io.newURI(`about:${aboutType}`);
30 const flags = am.getURIFlags(uri);
31 if (!(flags & Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT)) {
32 urls.push(`about:${aboutType}`);
35 // getService() might have thrown if the component doesn't actually
36 // implement nsIAboutModule