dom/ipc/StructuredCloneUtils.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* vim: set sw=4 ts=8 et 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/. */
     7 #ifndef mozilla_dom_StructuredCloneUtils_h
     8 #define mozilla_dom_StructuredCloneUtils_h
    10 #include "nsCOMPtr.h"
    11 #include "nsTArray.h"
    12 #include "nsIDOMFile.h"
    14 #include "js/StructuredClone.h"
    16 namespace mozilla {
    18 struct SerializedStructuredCloneBuffer;
    20 namespace dom {
    22 struct
    23 StructuredCloneClosure
    24 {
    25   nsTArray<nsCOMPtr<nsIDOMBlob> > mBlobs;
    26 };
    28 struct
    29 StructuredCloneData
    30 {
    31   StructuredCloneData() : mData(nullptr), mDataLength(0) {}
    32   uint64_t* mData;
    33   size_t mDataLength;
    34   StructuredCloneClosure mClosure;
    35 };
    37 bool
    38 ReadStructuredClone(JSContext* aCx, uint64_t* aData, size_t aDataLength,
    39                     const StructuredCloneClosure& aClosure,
    40                     JS::MutableHandle<JS::Value> aClone);
    42 inline bool
    43 ReadStructuredClone(JSContext* aCx, const StructuredCloneData& aData,
    44                     JS::MutableHandle<JS::Value> aClone)
    45 {
    46   return ReadStructuredClone(aCx, aData.mData, aData.mDataLength,
    47                              aData.mClosure, aClone);
    48 }
    50 bool
    51 WriteStructuredClone(JSContext* aCx, JS::Handle<JS::Value> aSource,
    52                      JSAutoStructuredCloneBuffer& aBuffer,
    53                      StructuredCloneClosure& aClosure);
    55 } // namespace dom
    56 } // namespace mozilla
    58 #endif // mozilla_dom_StructuredCloneUtils_h

mercurial