2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2006-06-16 00:30:44 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* A service that provides methods for synchronously loading a DOM in various
|
|
|
|
* ways.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsSyncLoadService_h__
|
|
|
|
#define nsSyncLoadService_h__
|
|
|
|
|
2011-06-18 07:05:41 +04:00
|
|
|
#include "nscore.h"
|
2006-06-16 00:30:44 +04:00
|
|
|
|
2019-03-08 12:04:11 +03:00
|
|
|
class nsICookieSettings;
|
2006-06-16 00:30:44 +04:00
|
|
|
class nsIInputStream;
|
|
|
|
class nsILoadGroup;
|
|
|
|
class nsIStreamListener;
|
2011-06-18 07:05:41 +04:00
|
|
|
class nsIURI;
|
|
|
|
class nsIPrincipal;
|
|
|
|
class nsIChannel;
|
2006-06-16 00:30:44 +04:00
|
|
|
|
2019-01-02 16:05:23 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class Document;
|
|
|
|
}
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2011-06-18 07:05:41 +04:00
|
|
|
class nsSyncLoadService {
|
2006-06-16 00:30:44 +04:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Synchronously load the document from the specified URI.
|
|
|
|
*
|
|
|
|
* @param aURI URI to load the document from.
|
2015-10-27 00:22:59 +03:00
|
|
|
* @param aContentPolicyType contentPolicyType to be set on the channel
|
2008-02-27 06:45:29 +03:00
|
|
|
* @param aLoaderPrincipal Principal of loading document. For security
|
2015-10-27 00:22:59 +03:00
|
|
|
* checks and referrer header.
|
|
|
|
* @param aSecurityFlags securityFlags to be set on the channel
|
2006-06-16 00:30:44 +04:00
|
|
|
* @param aLoadGroup The loadgroup to use for loading the document.
|
|
|
|
* @param aForceToXML Whether to parse the document as XML, regardless of
|
|
|
|
* content type.
|
2014-11-18 16:47:20 +03:00
|
|
|
* @param referrerPolicy Referrer policy.
|
2006-06-16 00:30:44 +04:00
|
|
|
* @param aResult [out] The document loaded from the URI.
|
|
|
|
*/
|
2019-03-08 12:04:11 +03:00
|
|
|
static nsresult LoadDocument(
|
|
|
|
nsIURI* aURI, nsContentPolicyType aContentPolicyType,
|
|
|
|
nsIPrincipal* aLoaderPrincipal, nsSecurityFlags aSecurityFlags,
|
|
|
|
nsILoadGroup* aLoadGroup, nsICookieSettings* aCookieSettings,
|
2019-08-21 16:24:45 +03:00
|
|
|
bool aForceToXML, mozilla::dom::ReferrerPolicy aReferrerPolicy,
|
2019-03-08 12:04:11 +03:00
|
|
|
mozilla::dom::Document** aResult);
|
2006-06-16 00:30:44 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Read input stream aIn in chunks and deliver synchronously to aListener.
|
|
|
|
*
|
2017-10-19 12:39:30 +03:00
|
|
|
* @param aIn The stream to be read. The ownership of this stream is taken.
|
2006-06-16 00:30:44 +04:00
|
|
|
* @param aListener The listener that will receive
|
|
|
|
* OnStartRequest/OnDataAvailable/OnStopRequest
|
|
|
|
* notifications.
|
|
|
|
* @param aChannel The channel that aIn was opened from.
|
|
|
|
*/
|
2017-10-19 12:39:30 +03:00
|
|
|
static nsresult PushSyncStreamToListener(already_AddRefed<nsIInputStream> aIn,
|
2006-06-16 00:30:44 +04:00
|
|
|
nsIStreamListener* aListener,
|
|
|
|
nsIChannel* aChannel);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsSyncLoadService_h__
|