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.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsAboutBlank.h"
7 #include "nsStringStream.h"
8 #include "nsNetUtil.h"
10 NS_IMPL_ISUPPORTS(nsAboutBlank, nsIAboutModule)
12 NS_IMETHODIMP
13 nsAboutBlank::NewChannel(nsIURI *aURI, nsIChannel **result)
14 {
15 NS_ENSURE_ARG_POINTER(aURI);
17 nsCOMPtr<nsIInputStream> in;
18 nsresult rv = NS_NewCStringInputStream(getter_AddRefs(in), EmptyCString());
19 if (NS_FAILED(rv)) return rv;
21 nsCOMPtr<nsIChannel> channel;
22 rv = NS_NewInputStreamChannel(getter_AddRefs(channel), aURI, in,
23 NS_LITERAL_CSTRING("text/html"),
24 NS_LITERAL_CSTRING("utf-8"));
25 if (NS_FAILED(rv)) return rv;
27 channel.forget(result);
28 return rv;
29 }
31 NS_IMETHODIMP
32 nsAboutBlank::GetURIFlags(nsIURI *aURI, uint32_t *result)
33 {
34 *result = nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
35 nsIAboutModule::HIDE_FROM_ABOUTABOUT;
36 return NS_OK;
37 }
39 nsresult
40 nsAboutBlank::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
41 {
42 nsAboutBlank* about = new nsAboutBlank();
43 if (about == nullptr)
44 return NS_ERROR_OUT_OF_MEMORY;
45 NS_ADDREF(about);
46 nsresult rv = about->QueryInterface(aIID, aResult);
47 NS_RELEASE(about);
48 return rv;
49 }
51 ////////////////////////////////////////////////////////////////////////////////