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.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * vim: sw=2 ts=2 sts=2 et |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | const Cc = Components.classes; |
michael@0 | 8 | const Ci = Components.interfaces; |
michael@0 | 9 | |
michael@0 | 10 | Components.utils.import("resource://gre/modules/NetUtil.jsm"); |
michael@0 | 11 | Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); |
michael@0 | 12 | |
michael@0 | 13 | const SCHEME = "place"; |
michael@0 | 14 | const URL = "chrome://browser/content/places/content-ui/controller.xhtml"; |
michael@0 | 15 | |
michael@0 | 16 | function PlacesProtocolHandler() {} |
michael@0 | 17 | |
michael@0 | 18 | PlacesProtocolHandler.prototype = { |
michael@0 | 19 | scheme: SCHEME, |
michael@0 | 20 | defaultPort: -1, |
michael@0 | 21 | protocolFlags: Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD | |
michael@0 | 22 | Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE | |
michael@0 | 23 | Ci.nsIProtocolHandler.URI_NORELATIVE | |
michael@0 | 24 | Ci.nsIProtocolHandler.URI_NOAUTH, |
michael@0 | 25 | |
michael@0 | 26 | newURI: function PPH_newURI(aSpec, aOriginCharset, aBaseUri) { |
michael@0 | 27 | let uri = Cc["@mozilla.org/network/simple-uri;1"].createInstance(Ci.nsIURI); |
michael@0 | 28 | uri.spec = aSpec; |
michael@0 | 29 | return uri; |
michael@0 | 30 | }, |
michael@0 | 31 | |
michael@0 | 32 | newChannel: function PPH_newChannel(aUri) { |
michael@0 | 33 | let chan = NetUtil.newChannel(URL); |
michael@0 | 34 | chan.originalURI = aUri; |
michael@0 | 35 | return chan; |
michael@0 | 36 | }, |
michael@0 | 37 | |
michael@0 | 38 | allowPort: function PPH_allowPort(aPort, aScheme) { |
michael@0 | 39 | return false; |
michael@0 | 40 | }, |
michael@0 | 41 | |
michael@0 | 42 | QueryInterface: XPCOMUtils.generateQI([ |
michael@0 | 43 | Ci.nsIProtocolHandler |
michael@0 | 44 | ]), |
michael@0 | 45 | |
michael@0 | 46 | classID: Components.ID("{6bcb9bde-9018-4443-a071-c32653469597}") |
michael@0 | 47 | }; |
michael@0 | 48 | |
michael@0 | 49 | this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PlacesProtocolHandler]); |