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"
|
2014-11-18 16:47:20 +03:00
|
|
|
#include "mozilla/net/ReferrerPolicy.h"
|
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 nsIDOMDocument;
|
|
|
|
class nsIChannel;
|
2006-06-16 00:30:44 +04:00
|
|
|
|
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.
|
|
|
|
*/
|
2015-10-27 00:22:59 +03:00
|
|
|
static nsresult LoadDocument(nsIURI *aURI,
|
|
|
|
nsContentPolicyType aContentPolicyType,
|
|
|
|
nsIPrincipal *aLoaderPrincipal,
|
|
|
|
nsSecurityFlags aSecurityFlags,
|
|
|
|
nsILoadGroup *aLoadGroup,
|
|
|
|
bool aForceToXML,
|
2014-11-18 16:47:20 +03:00
|
|
|
mozilla::net::ReferrerPolicy aReferrerPolicy,
|
2006-06-16 00:30:44 +04:00
|
|
|
nsIDOMDocument** aResult);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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__
|