netwerk/protocol/about/nsAboutBlank.cpp

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

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

mercurial