1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 * A service that provides methods for synchronously loading a DOM in various
12 #ifndef nsSyncLoadService_h__
13 #define nsSyncLoadService_h__
15 #include "mozilla/AlreadyAddRefed.h"
17 #include "nsIContentPolicy.h"
18 #include "nsILoadInfo.h"
19 #include "nsIReferrerInfo.h"
21 class nsICookieJarSettings
;
24 class nsIStreamListener
;
33 } // namespace mozilla
35 class nsSyncLoadService
{
38 * Synchronously load the document from the specified URI.
40 * @param aURI URI to load the document from.
41 * @param aContentPolicyType contentPolicyType to be set on the channel
42 * @param aLoaderPrincipal Principal of loading document. For security
43 * checks and referrer header.
44 * @param aSecurityFlags securityFlags to be set on the channel
45 * @param aLoadGroup The loadgroup to use for loading the document.
46 * @param aForceToXML Whether to parse the document as XML, regardless of
48 * @param referrerPolicy Referrer policy.
49 * @param aResult [out] The document loaded from the URI.
51 static nsresult
LoadDocument(
52 nsIURI
* aURI
, nsContentPolicyType aContentPolicyType
,
53 nsIPrincipal
* aLoaderPrincipal
, nsSecurityFlags aSecurityFlags
,
54 nsILoadGroup
* aLoadGroup
, nsICookieJarSettings
* aCookieJarSettings
,
55 bool aForceToXML
, mozilla::dom::ReferrerPolicy aReferrerPolicy
,
56 mozilla::dom::Document
** aResult
);
59 * Read input stream aIn in chunks and deliver synchronously to aListener.
61 * @param aIn The stream to be read. The ownership of this stream is taken.
62 * @param aListener The listener that will receive
63 * OnStartRequest/OnDataAvailable/OnStopRequest
65 * @param aChannel The channel that aIn was opened from.
67 static nsresult
PushSyncStreamToListener(already_AddRefed
<nsIInputStream
> aIn
,
68 nsIStreamListener
* aListener
,
69 nsIChannel
* aChannel
);
72 #endif // nsSyncLoadService_h__