1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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"
9 #include "nsContentUtils.h"
10 #include "nsIChannel.h"
12 NS_IMPL_ISUPPORTS(nsAboutBlank
, nsIAboutModule
)
15 nsAboutBlank::NewChannel(nsIURI
* aURI
, nsILoadInfo
* aLoadInfo
,
16 nsIChannel
** result
) {
17 NS_ENSURE_ARG_POINTER(aURI
);
19 nsCOMPtr
<nsIInputStream
> in
;
20 nsresult rv
= NS_NewCStringInputStream(getter_AddRefs(in
), ""_ns
);
21 if (NS_FAILED(rv
)) return rv
;
23 nsCOMPtr
<nsIChannel
> channel
;
24 rv
= NS_NewInputStreamChannelInternal(getter_AddRefs(channel
), aURI
,
25 in
.forget(), "text/html"_ns
, "utf-8"_ns
,
27 if (NS_FAILED(rv
)) return rv
;
29 channel
.forget(result
);
34 nsAboutBlank::GetURIFlags(nsIURI
* aURI
, uint32_t* result
) {
35 *result
= nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT
|
36 nsIAboutModule::URI_CAN_LOAD_IN_CHILD
|
37 nsIAboutModule::MAKE_LINKABLE
|
38 nsIAboutModule::HIDE_FROM_ABOUTABOUT
;
43 nsAboutBlank::GetChromeURI(nsIURI
* aURI
, nsIURI
** chromeURI
) {
44 return NS_ERROR_ILLEGAL_VALUE
;
47 nsresult
nsAboutBlank::Create(REFNSIID aIID
, void** aResult
) {
48 RefPtr
<nsAboutBlank
> about
= new nsAboutBlank();
49 return about
->QueryInterface(aIID
, aResult
);
52 ////////////////////////////////////////////////////////////////////////////////