browser/components/places/src/PlacesProtocolHandler.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/places/src/PlacesProtocolHandler.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,49 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * vim: sw=2 ts=2 sts=2 et
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +const Cc = Components.classes;
    1.11 +const Ci = Components.interfaces;
    1.12 +
    1.13 +Components.utils.import("resource://gre/modules/NetUtil.jsm");
    1.14 +Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
    1.15 +
    1.16 +const SCHEME = "place";
    1.17 +const URL = "chrome://browser/content/places/content-ui/controller.xhtml";
    1.18 +
    1.19 +function PlacesProtocolHandler() {}
    1.20 +
    1.21 +PlacesProtocolHandler.prototype = {
    1.22 +  scheme: SCHEME,
    1.23 +  defaultPort: -1,
    1.24 +  protocolFlags: Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD |
    1.25 +                 Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE |
    1.26 +                 Ci.nsIProtocolHandler.URI_NORELATIVE |
    1.27 +                 Ci.nsIProtocolHandler.URI_NOAUTH,
    1.28 +
    1.29 +  newURI: function PPH_newURI(aSpec, aOriginCharset, aBaseUri) {
    1.30 +    let uri = Cc["@mozilla.org/network/simple-uri;1"].createInstance(Ci.nsIURI);
    1.31 +    uri.spec = aSpec;
    1.32 +    return uri;
    1.33 +  },
    1.34 +
    1.35 +  newChannel: function PPH_newChannel(aUri) {
    1.36 +    let chan = NetUtil.newChannel(URL);
    1.37 +    chan.originalURI = aUri;
    1.38 +    return chan;
    1.39 +  },
    1.40 +
    1.41 +  allowPort: function PPH_allowPort(aPort, aScheme) {
    1.42 +    return false;
    1.43 +  },
    1.44 +
    1.45 +  QueryInterface: XPCOMUtils.generateQI([
    1.46 +    Ci.nsIProtocolHandler
    1.47 +  ]),
    1.48 +
    1.49 +  classID: Components.ID("{6bcb9bde-9018-4443-a071-c32653469597}")
    1.50 +};
    1.51 +
    1.52 +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PlacesProtocolHandler]);

mercurial