Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | /* |
michael@0 | 7 | * A service that provides methods for synchronously loading a DOM in various ways. |
michael@0 | 8 | */ |
michael@0 | 9 | |
michael@0 | 10 | #ifndef nsSyncLoadService_h__ |
michael@0 | 11 | #define nsSyncLoadService_h__ |
michael@0 | 12 | |
michael@0 | 13 | #include "nscore.h" |
michael@0 | 14 | |
michael@0 | 15 | class nsIInputStream; |
michael@0 | 16 | class nsILoadGroup; |
michael@0 | 17 | class nsIStreamListener; |
michael@0 | 18 | class nsIURI; |
michael@0 | 19 | class nsIPrincipal; |
michael@0 | 20 | class nsIDOMDocument; |
michael@0 | 21 | class nsIChannel; |
michael@0 | 22 | |
michael@0 | 23 | class nsSyncLoadService |
michael@0 | 24 | { |
michael@0 | 25 | public: |
michael@0 | 26 | /** |
michael@0 | 27 | * Synchronously load the document from the specified URI. |
michael@0 | 28 | * |
michael@0 | 29 | * @param aURI URI to load the document from. |
michael@0 | 30 | * @param aLoaderPrincipal Principal of loading document. For security |
michael@0 | 31 | * checks and referrer header. May be null if no |
michael@0 | 32 | * security checks should be done. |
michael@0 | 33 | * @param aLoadGroup The loadgroup to use for loading the document. |
michael@0 | 34 | * @param aForceToXML Whether to parse the document as XML, regardless of |
michael@0 | 35 | * content type. |
michael@0 | 36 | * @param aResult [out] The document loaded from the URI. |
michael@0 | 37 | */ |
michael@0 | 38 | static nsresult LoadDocument(nsIURI *aURI, nsIPrincipal *aLoaderPrincipal, |
michael@0 | 39 | nsILoadGroup *aLoadGroup, bool aForceToXML, |
michael@0 | 40 | nsIDOMDocument** aResult); |
michael@0 | 41 | |
michael@0 | 42 | /** |
michael@0 | 43 | * Read input stream aIn in chunks and deliver synchronously to aListener. |
michael@0 | 44 | * |
michael@0 | 45 | * @param aIn The stream to be read. |
michael@0 | 46 | * @param aListener The listener that will receive |
michael@0 | 47 | * OnStartRequest/OnDataAvailable/OnStopRequest |
michael@0 | 48 | * notifications. |
michael@0 | 49 | * @param aChannel The channel that aIn was opened from. |
michael@0 | 50 | */ |
michael@0 | 51 | static nsresult PushSyncStreamToListener(nsIInputStream* aIn, |
michael@0 | 52 | nsIStreamListener* aListener, |
michael@0 | 53 | nsIChannel* aChannel); |
michael@0 | 54 | }; |
michael@0 | 55 | |
michael@0 | 56 | #endif // nsSyncLoadService_h__ |