tor-browser

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

PWebBrowserPersistDocument.ipdl (3269B)


      1 /* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3  * License, v. 2.0. If a copy of the MPL was not distributed with this
      4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 include protocol PContent;
      7 include protocol PWebBrowserPersistResources;
      8 include protocol PWebBrowserPersistSerialize;
      9 
     10 include PBackgroundSharedTypes;
     11 include IPCStream;
     12 include NeckoChannelParams;
     13 
     14 include "mozilla/dom/ReferrerInfoUtils.h";
     15 
     16 [RefCounted] using class nsIReferrerInfo from "nsIReferrerInfo.h";
     17 
     18 namespace mozilla {
     19 
     20 // nsIWebBrowserPersistDocument has attributes which can be read
     21 // synchronously.  To avoid using sync IPC for them, the actor sends
     22 // this structure from the child to the parent before the parent actor
     23 // is exposed to XPCOM.
     24 struct WebBrowserPersistDocumentAttrs {
     25   bool isPrivate;
     26   nsCString documentURI;
     27   nsCString baseURI;
     28   nsCString contentType;
     29   nsCString characterSet;
     30   nsString title;
     31   nullable nsIReferrerInfo referrerInfo;
     32   CookieJarSettingsArgs cookieJarSettings;
     33   nsString contentDisposition;
     34   uint32_t sessionHistoryCacheKey;
     35   uint32_t persistFlags;
     36   PrincipalInfo principal;
     37 };
     38 
     39 // IPDL doesn't have tuples, so this gives the pair of strings from
     40 // nsIWebBrowserPersistURIMap::getURIMapping a name.
     41 struct WebBrowserPersistURIMapEntry {
     42   nsCString mapFrom;
     43   nsCString mapTo;
     44 };
     45 
     46 // nsIWebBrowserPersistURIMap is just copied over IPC as one of these,
     47 // not proxied, to simplify the protocol.
     48 struct WebBrowserPersistURIMap {
     49   WebBrowserPersistURIMapEntry[] mapURIs;
     50   nsCString targetBaseURI;
     51 };
     52 
     53 // This remotes nsIWebBrowserPersistDocument and its visitors.  The
     54 // lifecycle is a little complicated: the initial document is
     55 // constructed parent->child, but subdocuments are constructed
     56 // child->parent and then passed back.  Subdocuments aren't subactors,
     57 // because that would impose a lifetime relationship that doesn't
     58 // exist in the XPIDL; instead they're all managed by the enclosing
     59 // PContent.
     60 protocol PWebBrowserPersistDocument {
     61   manager PContent;
     62   manages PWebBrowserPersistResources;
     63   manages PWebBrowserPersistSerialize;
     64 
     65 parent:
     66   // The actor isn't exposed to XPCOM until after it gets one of these
     67   // two messages; see also the state transition rules.  The message
     68   // is either a response to the constructor (if it was parent->child)
     69   // or sent after it (if it was child->parent).
     70   async Attributes(WebBrowserPersistDocumentAttrs aAttrs,
     71                    IPCStream? stream);
     72   async InitFailure(nsresult aStatus);
     73 
     74 child:
     75   async SetPersistFlags(uint32_t aNewFlags);
     76   async PWebBrowserPersistResources();
     77   async PWebBrowserPersistSerialize(WebBrowserPersistURIMap aMap,
     78                                     nsCString aRequestedContentType,
     79                                     uint32_t aEncoderFlags,
     80                                     uint32_t aWrapColumn);
     81   async __delete__();
     82 
     83 /*
     84 state START:
     85   recv Attributes goto MAIN;
     86   recv InitFailure goto FAILED;
     87 
     88 state MAIN:
     89   send SetPersistFlags goto MAIN;
     90   send PWebBrowserPersistResources goto MAIN;
     91   send PWebBrowserPersistSerialize goto MAIN;
     92   send __delete__;
     93 
     94 state FAILED:
     95   send __delete__;
     96 */
     97 };
     98 
     99 } // namespace mozilla