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 vm_ArgumentsObject_inl_h
8 #define vm_ArgumentsObject_inl_h
10 #include "vm/ArgumentsObject.h"
12 #include "vm/ScopeObject.h"
14 #include "jsscriptinlines.h"
16 #include "vm/ScopeObject-inl.h"
18 namespace js {
20 inline const Value &
21 ArgumentsObject::element(uint32_t i) const
22 {
23 JS_ASSERT(!isElementDeleted(i));
24 const Value &v = data()->args[i];
25 if (v.isMagic()) {
26 CallObject &callobj = getFixedSlot(MAYBE_CALL_SLOT).toObject().as<CallObject>();
27 return callobj.aliasedVarFromArguments(v);
28 }
29 return v;
30 }
32 inline void
33 ArgumentsObject::setElement(JSContext *cx, uint32_t i, const Value &v)
34 {
35 JS_ASSERT(!isElementDeleted(i));
36 HeapValue &lhs = data()->args[i];
37 if (lhs.isMagic()) {
38 uint32_t slot = lhs.magicUint32();
39 CallObject &callobj = getFixedSlot(MAYBE_CALL_SLOT).toObject().as<CallObject>();
40 for (Shape::Range<NoGC> r(callobj.lastProperty()); !r.empty(); r.popFront()) {
41 if (r.front().slot() == slot) {
42 callobj.setAliasedVarFromArguments(cx, lhs, r.front().propid(), v);
43 return;
44 }
45 }
46 MOZ_ASSUME_UNREACHABLE("Bad Arguments::setElement");
47 }
48 lhs = v;
49 }
51 inline bool
52 ArgumentsObject::maybeGetElements(uint32_t start, uint32_t count, Value *vp)
53 {
54 JS_ASSERT(start + count >= start);
56 uint32_t length = initialLength();
57 if (start > length || start + count > length || isAnyElementDeleted())
58 return false;
60 for (uint32_t i = start, end = start + count; i < end; ++i, ++vp)
61 *vp = element(i);
62 return true;
63 }
65 } /* namespace js */
67 #endif /* vm_ArgumentsObject_inl_h */