Sat, 03 Jan 2015 20:18:00 +0100
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: 2; 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/. */
6 #include "SharedDIB.h"
8 namespace mozilla {
9 namespace gfx {
11 SharedDIB::SharedDIB() :
12 mShMem(nullptr)
13 {
14 }
16 SharedDIB::~SharedDIB()
17 {
18 Close();
19 }
21 nsresult
22 SharedDIB::Create(uint32_t aSize)
23 {
24 Close();
26 mShMem = new base::SharedMemory();
27 if (!mShMem || !mShMem->Create("", false, false, aSize))
28 return NS_ERROR_OUT_OF_MEMORY;
30 return NS_OK;
31 }
33 bool
34 SharedDIB::IsValid()
35 {
36 if (!mShMem)
37 return false;
39 return mShMem->IsHandleValid(mShMem->handle());
40 }
42 nsresult
43 SharedDIB::Close()
44 {
45 delete mShMem;
47 mShMem = nullptr;
49 return NS_OK;
50 }
52 nsresult
53 SharedDIB::Attach(Handle aHandle, uint32_t aSize)
54 {
55 Close();
57 mShMem = new base::SharedMemory(aHandle, false);
58 if(!mShMem)
59 return NS_ERROR_OUT_OF_MEMORY;
61 return NS_OK;
62 }
64 nsresult
65 SharedDIB::ShareToProcess(base::ProcessHandle aChildProcess, Handle *aChildHandle)
66 {
67 if (!mShMem)
68 return NS_ERROR_UNEXPECTED;
70 if (!mShMem->ShareToProcess(aChildProcess, aChildHandle))
71 return NS_ERROR_UNEXPECTED;
73 return NS_OK;
74 }
76 } // gfx
77 } // mozilla