content/base/src/nsSyncLoadService.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/src/nsSyncLoadService.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,56 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/*
    1.10 + * A service that provides methods for synchronously loading a DOM in various ways.
    1.11 + */
    1.12 +
    1.13 +#ifndef nsSyncLoadService_h__
    1.14 +#define nsSyncLoadService_h__
    1.15 +
    1.16 +#include "nscore.h"
    1.17 +
    1.18 +class nsIInputStream;
    1.19 +class nsILoadGroup;
    1.20 +class nsIStreamListener;
    1.21 +class nsIURI;
    1.22 +class nsIPrincipal;
    1.23 +class nsIDOMDocument;
    1.24 +class nsIChannel;
    1.25 +
    1.26 +class nsSyncLoadService
    1.27 +{
    1.28 +public:
    1.29 +    /**
    1.30 +     * Synchronously load the document from the specified URI.
    1.31 +     *
    1.32 +     * @param aURI URI to load the document from.
    1.33 +     * @param aLoaderPrincipal Principal of loading document. For security
    1.34 +     *                         checks and referrer header. May be null if no
    1.35 +     *                         security checks should be done.
    1.36 +     * @param aLoadGroup The loadgroup to use for loading the document.
    1.37 +     * @param aForceToXML Whether to parse the document as XML, regardless of
    1.38 +     *                    content type.
    1.39 +     * @param aResult [out] The document loaded from the URI.
    1.40 +     */
    1.41 +    static nsresult LoadDocument(nsIURI *aURI, nsIPrincipal *aLoaderPrincipal,
    1.42 +                                 nsILoadGroup *aLoadGroup, bool aForceToXML,
    1.43 +                                 nsIDOMDocument** aResult);
    1.44 +
    1.45 +    /**
    1.46 +     * Read input stream aIn in chunks and deliver synchronously to aListener.
    1.47 +     *
    1.48 +     * @param aIn The stream to be read.
    1.49 +     * @param aListener The listener that will receive
    1.50 +     *                  OnStartRequest/OnDataAvailable/OnStopRequest
    1.51 +     *                  notifications.
    1.52 +     * @param aChannel The channel that aIn was opened from.
    1.53 +     */
    1.54 +    static nsresult PushSyncStreamToListener(nsIInputStream* aIn,
    1.55 +                                             nsIStreamListener* aListener,
    1.56 +                                             nsIChannel* aChannel);
    1.57 +};
    1.58 +
    1.59 +#endif // nsSyncLoadService_h__

mercurial