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.

     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 ////////////////////////////////////////////////////////////////////////////////

mercurial