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: 4 -*-
2 * vim: set ts=8 sts=4 et sw=4 tw=99:
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 jit_CompilerRoot_h
8 #define jit_CompilerRoot_h
10 #ifdef JS_ION
12 #include "jscntxt.h"
14 #include "jit/Ion.h"
15 #include "jit/IonAllocPolicy.h"
16 #include "js/RootingAPI.h"
18 namespace js {
19 namespace jit {
21 // Roots a read-only GCThing for the lifetime of a single compilation.
22 // Each root is maintained in a linked list that is walked over during tracing.
23 // The CompilerRoot must be heap-allocated and may not go out of scope.
24 template <typename T>
25 class CompilerRoot : public CompilerRootNode
26 {
27 public:
28 CompilerRoot(T ptr)
29 : CompilerRootNode(nullptr)
30 {
31 if (ptr) {
32 JS_ASSERT(!GetIonContext()->runtime->isInsideNursery(ptr));
33 setRoot(ptr);
34 }
35 }
37 public:
38 // Sets the pointer and inserts into root list. The pointer becomes read-only.
39 void setRoot(T root) {
40 CompilerRootNode *&rootList = GetIonContext()->temp->rootList();
42 JS_ASSERT(!ptr_);
43 ptr_ = root;
44 next = rootList;
45 rootList = this;
46 }
48 public:
49 operator T () const { return static_cast<T>(ptr_); }
50 T operator ->() const { return static_cast<T>(ptr_); }
52 private:
53 CompilerRoot() MOZ_DELETE;
54 CompilerRoot(const CompilerRoot<T> &) MOZ_DELETE;
55 CompilerRoot<T> &operator =(const CompilerRoot<T> &) MOZ_DELETE;
56 };
58 typedef CompilerRoot<JSObject*> CompilerRootObject;
59 typedef CompilerRoot<JSFunction*> CompilerRootFunction;
60 typedef CompilerRoot<JSScript*> CompilerRootScript;
61 typedef CompilerRoot<PropertyName*> CompilerRootPropertyName;
62 typedef CompilerRoot<Shape*> CompilerRootShape;
63 typedef CompilerRoot<Value> CompilerRootValue;
65 } // namespace jit
66 } // namespace js
68 #endif // JS_ION
70 #endif /* jit_CompilerRoot_h */