tor-browser

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

PBackgroundLSSharedTypes.ipdlh (2687B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 include PBackgroundSharedTypes;
      6 include ProtocolTypes;
      7 
      8 include "mozilla/dom/localstorage/SerializationHelpers.h";
      9 
     10 using mozilla::dom::LSValue
     11   from "mozilla/dom/LSValue.h";
     12 
     13 namespace mozilla {
     14 namespace dom {
     15 
     16 struct LSRequestCommonParams
     17 {
     18   PrincipalInfo principalInfo;
     19   PrincipalInfo storagePrincipalInfo;
     20   nsCString originKey;
     21 };
     22 
     23 struct LSRequestPreloadDatastoreParams
     24 {
     25   LSRequestCommonParams commonParams;
     26 };
     27 
     28 struct LSRequestPrepareDatastoreParams
     29 {
     30   LSRequestCommonParams commonParams;
     31   nsID? clientId;
     32   PrincipalInfo? clientPrincipalInfo;
     33 };
     34 
     35 /**
     36  * In order to validate the principal with the client, we need to provide an
     37  * additional principalInfo for the client. The client is using the foreign
     38  * principal, see StoragePrincipalHelper.h for details, which is different from
     39  * the principalInfo. So, we need to pass the principalInfo from the client So
     40  * that we can verify it with the given client Id.
     41  *
     42  * Note that the storagePrincipalInfo is used to access the right cookie jar
     43  * according to the Storage Access. This is passed in order to access the
     44  * correct local storage. Essentially, the storage principal and the client
     45  * principal are using the PartitionKey in their OriginAttributes. But, the
     46  * existence of the PartitionKey between them is depending on different
     47  * conditions. Namely, the storage principal depends on the Storage Access but
     48  * the client principal depends on whether it's in a third party.
     49  */
     50 struct LSRequestPrepareObserverParams
     51 {
     52   PrincipalInfo principalInfo;
     53   PrincipalInfo storagePrincipalInfo;
     54   nsID? clientId;
     55   PrincipalInfo? clientPrincipalInfo;
     56 };
     57 
     58 union LSRequestParams
     59 {
     60   LSRequestPreloadDatastoreParams;
     61   LSRequestPrepareDatastoreParams;
     62   LSRequestPrepareObserverParams;
     63 };
     64 
     65 struct LSSimpleRequestPreloadedParams
     66 {
     67   PrincipalInfo principalInfo;
     68   PrincipalInfo storagePrincipalInfo;
     69 };
     70 
     71 struct LSSimpleRequestGetStateParams
     72 {
     73   PrincipalInfo principalInfo;
     74   PrincipalInfo storagePrincipalInfo;
     75 };
     76 
     77 union LSSimpleRequestParams
     78 {
     79   LSSimpleRequestPreloadedParams;
     80   LSSimpleRequestGetStateParams;
     81 };
     82 
     83 /**
     84  * LocalStorage key/value pair wire representations.  `value` may be void in
     85  * cases where there is a value but it is not being sent for memory/bandwidth
     86  * conservation purposes.  (It's not possible to have a null/undefined `value`
     87  * as Storage is defined explicitly as a String store.)
     88  */
     89 struct LSItemInfo
     90 {
     91   nsString key;
     92   LSValue value;
     93 };
     94 
     95 } // namespace dom
     96 } // namespace mozilla