tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsSyncLoadService.h (2598B)


      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/. */
      6 
      7 /*
      8 * A service that provides methods for synchronously loading a DOM in various
      9 * ways.
     10 */
     11 
     12 #ifndef nsSyncLoadService_h__
     13 #define nsSyncLoadService_h__
     14 
     15 #include "mozilla/AlreadyAddRefed.h"
     16 #include "nsIContentPolicy.h"
     17 #include "nsILoadInfo.h"
     18 #include "nsIReferrerInfo.h"
     19 #include "nscore.h"
     20 
     21 class nsICookieJarSettings;
     22 class nsIInputStream;
     23 class nsILoadGroup;
     24 class nsIStreamListener;
     25 class nsIURI;
     26 class nsIPrincipal;
     27 class nsIChannel;
     28 
     29 namespace mozilla::dom {
     30 class Document;
     31 }  // namespace mozilla::dom
     32 
     33 class nsSyncLoadService {
     34 public:
     35  /**
     36   * Synchronously load the document from the specified URI.
     37   *
     38   * @param aURI URI to load the document from.
     39   * @param aContentPolicyType contentPolicyType to be set on the channel
     40   * @param aLoaderPrincipal Principal of loading document. For security
     41   *                         checks and referrer header.
     42   * @param aSecurityFlags securityFlags to be set on the channel
     43   * @param aLoadGroup The loadgroup to use for loading the document.
     44   * @param aForceToXML Whether to parse the document as XML, regardless of
     45   *                    content type.
     46   * @param referrerPolicy Referrer policy.
     47   * @param aResult [out] The document loaded from the URI.
     48   */
     49  static nsresult LoadDocument(
     50      nsIURI* aURI, nsContentPolicyType aContentPolicyType,
     51      mozilla::dom::Document* aLoaderDoc, nsIPrincipal* aLoaderPrincipal,
     52      nsSecurityFlags aSecurityFlags, nsILoadGroup* aLoadGroup,
     53      nsICookieJarSettings* aCookieJarSettings, bool aForceToXML,
     54      mozilla::dom::ReferrerPolicy aReferrerPolicy,
     55      mozilla::dom::Document** aResult);
     56 
     57  /**
     58   * Read input stream aIn in chunks and deliver synchronously to aListener.
     59   *
     60   * @param aIn The stream to be read. The ownership of this stream is taken.
     61   * @param aListener The listener that will receive
     62   *                  OnStartRequest/OnDataAvailable/OnStopRequest
     63   *                  notifications.
     64   * @param aChannel The channel that aIn was opened from.
     65   */
     66  static nsresult PushSyncStreamToListener(already_AddRefed<nsIInputStream> aIn,
     67                                           nsIStreamListener* aListener,
     68                                           nsIChannel* aChannel);
     69 };
     70 
     71 #endif  // nsSyncLoadService_h__