Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 const Cc = Components.classes;
6 const Ci = Components.interfaces;
7 var gProtocols = [];
8 var gContainer;
9 window.onload = function () {
10 gContainer = document.getElementById("abouts");
11 findAbouts();
12 }
14 function findAbouts() {
15 var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
16 for (var cid in Cc) {
17 var result = cid.match(/@mozilla.org\/network\/protocol\/about;1\?what\=(.*)$/);
18 if (result) {
19 var aboutType = result[1];
20 var contract = "@mozilla.org/network/protocol/about;1?what=" + aboutType;
21 try {
22 var am = Cc[contract].getService(Ci.nsIAboutModule);
23 var uri = ios.newURI("about:"+aboutType, null, null);
24 var flags = am.getURIFlags(uri);
25 if (!(flags & Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT)) {
26 gProtocols.push(aboutType);
27 }
28 } catch (e) {
29 // getService might have thrown if the component doesn't actually
30 // implement nsIAboutModule
31 }
32 }
33 }
34 gProtocols.sort().forEach(createProtocolListing);
35 }
37 function createProtocolListing(aProtocol) {
38 var uri = "about:" + aProtocol;
39 var li = document.createElement("li");
40 var link = document.createElement("a");
41 var text = document.createTextNode(uri);
43 link.href = uri;
44 link.appendChild(text);
45 li.appendChild(link);
46 gContainer.appendChild(li);
47 }