Bug 220253: Port about:about to Toolkit, but only show useful 'about' pages. ui-r=beltzner, r=mconnor
authorSteffen Wilberg <steffen.wilberg@web.de>
Fri, 21 Aug 2009 21:28:46 +0200
changeset 36933 f405075062de2a63fce1afabad0fb73cdf8592e2
parent 36932 28d4c34835413e8281147f6fc903827df8cfe0fe
child 36934 ec146a976e9953a485bee3fa0a8bc7f3af5b4436
push idunknown
push userunknown
push dateunknown
reviewersbeltzner, mconnor
bugs220253
milestone1.9.3a1pre
Bug 220253: Port about:about to Toolkit, but only show useful 'about' pages. ui-r=beltzner, r=mconnor
docshell/base/nsAboutRedirector.cpp
docshell/build/nsDocShellModule.cpp
toolkit/content/aboutAbout.xhtml
toolkit/content/jar.mn
toolkit/locales/en-US/chrome/global/aboutAbout.dtd
toolkit/locales/jar.mn
toolkit/themes/winstripe/global/about.css
--- a/docshell/base/nsAboutRedirector.cpp
+++ b/docshell/base/nsAboutRedirector.cpp
@@ -59,16 +59,17 @@ struct RedirEntry {
   URI_SAFE_FOR_UNTRUSTED_CONTENT in the third argument to each map item below
   unless your about: page really needs chrome privileges. Security review is
   required before adding new map entries without
   URI_SAFE_FOR_UNTRUSTED_CONTENT.  Also note, however, that adding
   URI_SAFE_FOR_UNTRUSTED_CONTENT will allow random web sites to link to that
   URI.  Perhaps we should separate the two concepts out...
  */
 static RedirEntry kRedirMap[] = {
+    { "about", "chrome://global/content/aboutAbout.xhtml", 0 },
     { "credits", "http://www.mozilla.org/credits/",
       nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT },
     { "mozilla", "chrome://global/content/mozilla.xhtml",
       nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT },
     { "plugins", "chrome://global/content/plugins.html", 0 },
     { "config", "chrome://global/content/config.xul", 0 },
 #ifdef MOZ_CRASHREPORTER
     { "crashes", "chrome://global/content/crashes.xhtml", 0 },
--- a/docshell/build/nsDocShellModule.cpp
+++ b/docshell/build/nsDocShellModule.cpp
@@ -147,16 +147,21 @@ static const nsModuleComponentInfo gDocS
     {
       "Channel classifier",
       NS_CHANNELCLASSIFIER_CID,
       NS_CHANNELCLASSIFIER_CONTRACTID,
       nsClassifierCallbackConstructor
     },
 
     // about redirector
+    { "about:about",
+      NS_ABOUT_REDIRECTOR_MODULE_CID,
+      NS_ABOUT_MODULE_CONTRACTID_PREFIX "about",
+      nsAboutRedirector::Create
+    },
     { "about:config",
       NS_ABOUT_REDIRECTOR_MODULE_CID,
       NS_ABOUT_MODULE_CONTRACTID_PREFIX "config",
       nsAboutRedirector::Create
     },
 #ifdef MOZ_CRASHREPORTER
     { "about:crashes",
       NS_ABOUT_REDIRECTOR_MODULE_CID,
new file mode 100644
--- /dev/null
+++ b/toolkit/content/aboutAbout.xhtml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" [
+<!ENTITY % aboutAboutDTD SYSTEM "chrome://global/locale/aboutAbout.dtd" >
+%aboutAboutDTD;
+]>
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is about:about.
+#
+# The Initial Developer of the Original Code is
+# Christopher A. Aillon <christopher@aillon.com>.
+# Portions created by the Initial Developer are Copyright (C) 2003
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   Christopher A. Aillon <christopher@aillon.com>
+#   Steffen Wilberg <steffen.wilberg@web.de>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <title>&aboutAbout.title;</title>
+  <link rel="stylesheet" href="chrome://global/skin/about.css" type="text/css"/>
+  <script type="application/javascript"><![CDATA[
+    var gProtocols = [];
+    var gContainer;
+    const BLACKLIST = ["blank", "blocked", "cache-entry", "certerror", "feeds", "neterror"];
+    window.onload = function () {
+      gContainer = document.getElementById("abouts");
+      findAbouts();
+    }
+
+    function findAbouts() {
+      for (var cid in Components.classes) {
+        var result = cid.match(/@mozilla.org\/network\/protocol\/about;1\?what\=(.*)$/);
+        if (result && (BLACKLIST.indexOf(result[1]) == -1))
+          gProtocols.push(result[1]);
+      }
+      gProtocols.sort().forEach(createProtocolListing);
+    }
+
+    function createProtocolListing(aProtocol) {
+      var uri = "about:" + aProtocol;
+      var li = document.createElement("li");
+      var link = document.createElement("a");
+      var text = document.createTextNode(uri);
+
+      link.href = uri;
+      link.appendChild(text);
+      li.appendChild(link);
+      gContainer.appendChild(li);
+    }
+  ]]></script>
+</head>
+
+<body>
+  <h1>&aboutAbout.title;</h1>
+  <p><em>&aboutAbout.note;</em></p>
+  <ul id="abouts" class="columns"></ul>
+</body>
+</html>
--- a/toolkit/content/jar.mn
+++ b/toolkit/content/jar.mn
@@ -6,16 +6,17 @@ toolkit.jar:
 # work with Geckos from before 1.9, when there was a separate file
 %  override chrome://global/content/nsTransferable.js chrome://global/content/nsDragAndDrop.js
 *  content/global/license.html                (license.html)
    content/global/XPCNativeWrapper.js         (XPCNativeWrapper.js)
 *  content/global/xul.css                     (xul.css)
    content/global/textbox.css                 (textbox.css)
    content/global/menulist.css                (menulist.css)
 *  content/global/about.xhtml                 (about.xhtml)
+*  content/global/aboutAbout.xhtml            (aboutAbout.xhtml)
 *  content/global/aboutRights.xhtml           (aboutRights.xhtml)
 *  content/global/aboutRights-unbranded.xhtml (aboutRights-unbranded.xhtml)
    content/global/directionDetector.html
    content/global/plugins.html
    content/global/plugins.css
 *+  content/global/buildconfig.html            (buildconfig.html)
 +  content/global/charsetOverlay.js           (charsetOverlay.js)
 +  content/global/charsetOverlay.xul          (charsetOverlay.xul)
new file mode 100644
--- /dev/null
+++ b/toolkit/locales/en-US/chrome/global/aboutAbout.dtd
@@ -0,0 +1,4 @@
+<!ENTITY aboutAbout.title  "About About">
+<!ENTITY aboutAbout.note   "This is a list of “about” pages for your convenience.<br/>
+                            Some of them might be confusing. Some are for diagnostic purposes only.<br/>
+                            And some are omitted because they require query strings.">
--- a/toolkit/locales/jar.mn
+++ b/toolkit/locales/jar.mn
@@ -1,13 +1,14 @@
 #filter substitution
 
 @AB_CD@.jar:
 % locale global @AB_CD@ %locale/@AB_CD@/global/
   locale/@AB_CD@/global/about.dtd                       (%chrome/global/about.dtd)
+  locale/@AB_CD@/global/aboutAbout.dtd                  (%chrome/global/aboutAbout.dtd)
   locale/@AB_CD@/global/aboutRights.dtd                 (%chrome/global/aboutRights.dtd)
   locale/@AB_CD@/global/aboutRights.properties          (%chrome/global/aboutRights.properties)
   locale/@AB_CD@/global/appPicker.dtd                   (%chrome/global/appPicker.dtd)
   locale/@AB_CD@/global/brand.dtd                       (generic/chrome/global/brand.dtd)
 + locale/@AB_CD@/global/browser.properties              (%chrome/global/browser.properties)
 + locale/@AB_CD@/global/charsetOverlay.dtd              (%chrome/global/charsetOverlay.dtd)
 + locale/@AB_CD@/global/commonDialog.dtd                (%chrome/global/commonDialog.dtd)
 + locale/@AB_CD@/global/commonDialogs.properties        (%chrome/global/commonDialogs.properties)
--- a/toolkit/themes/winstripe/global/about.css
+++ b/toolkit/themes/winstripe/global/about.css
@@ -46,8 +46,13 @@ ul {
 
 ul > li {
   margin-top: .5em;
 }
 
 th, td {
   padding: 0 5px;
 }
+
+.columns {
+  -moz-column-width: 20em;
+  -moz-column-gap: 3em;
+}