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: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=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 file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_indexeddb_idbwrappercache_h__
8 #define mozilla_dom_indexeddb_idbwrappercache_h__
10 #include "mozilla/DOMEventTargetHelper.h"
11 #include "mozilla/dom/indexedDB/IndexedDatabase.h"
13 BEGIN_INDEXEDDB_NAMESPACE
15 class IDBWrapperCache : public DOMEventTargetHelper
16 {
17 public:
18 NS_DECL_ISUPPORTS_INHERITED
19 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
20 IDBWrapperCache,
21 DOMEventTargetHelper)
23 JSObject* GetScriptOwner() const
24 {
25 return mScriptOwner;
26 }
27 void SetScriptOwner(JSObject* aScriptOwner);
29 JSObject* GetParentObject()
30 {
31 if (mScriptOwner) {
32 return mScriptOwner;
33 }
35 // Do what nsEventTargetSH::PreCreate does.
36 nsCOMPtr<nsIScriptGlobalObject> parent;
37 DOMEventTargetHelper::GetParentObject(getter_AddRefs(parent));
39 return parent ? parent->GetGlobalJSObject() : nullptr;
40 }
42 #ifdef DEBUG
43 void AssertIsRooted() const;
44 #else
45 inline void AssertIsRooted() const
46 {
47 }
48 #endif
50 protected:
51 IDBWrapperCache(DOMEventTargetHelper* aOwner)
52 : DOMEventTargetHelper(aOwner), mScriptOwner(nullptr)
53 { }
54 IDBWrapperCache(nsPIDOMWindow* aOwner)
55 : DOMEventTargetHelper(aOwner), mScriptOwner(nullptr)
56 { }
58 virtual ~IDBWrapperCache();
60 private:
61 JS::Heap<JSObject*> mScriptOwner;
62 };
64 END_INDEXEDDB_NAMESPACE
66 #endif // mozilla_dom_indexeddb_idbwrappercache_h__