toolkit/content/aboutAbout.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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 }

mercurial