browser/components/places/src/PlacesProtocolHandler.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     2  * vim: sw=2 ts=2 sts=2 et
     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/. */
     7 const Cc = Components.classes;
     8 const Ci = Components.interfaces;
    10 Components.utils.import("resource://gre/modules/NetUtil.jsm");
    11 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
    13 const SCHEME = "place";
    14 const URL = "chrome://browser/content/places/content-ui/controller.xhtml";
    16 function PlacesProtocolHandler() {}
    18 PlacesProtocolHandler.prototype = {
    19   scheme: SCHEME,
    20   defaultPort: -1,
    21   protocolFlags: Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD |
    22                  Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE |
    23                  Ci.nsIProtocolHandler.URI_NORELATIVE |
    24                  Ci.nsIProtocolHandler.URI_NOAUTH,
    26   newURI: function PPH_newURI(aSpec, aOriginCharset, aBaseUri) {
    27     let uri = Cc["@mozilla.org/network/simple-uri;1"].createInstance(Ci.nsIURI);
    28     uri.spec = aSpec;
    29     return uri;
    30   },
    32   newChannel: function PPH_newChannel(aUri) {
    33     let chan = NetUtil.newChannel(URL);
    34     chan.originalURI = aUri;
    35     return chan;
    36   },
    38   allowPort: function PPH_allowPort(aPort, aScheme) {
    39     return false;
    40   },
    42   QueryInterface: XPCOMUtils.generateQI([
    43     Ci.nsIProtocolHandler
    44   ]),
    46   classID: Components.ID("{6bcb9bde-9018-4443-a071-c32653469597}")
    47 };
    49 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PlacesProtocolHandler]);

mercurial