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.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * vim: set ts=8 sts=4 et sw=4 tw=99: |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef vm_ArgumentsObject_inl_h |
michael@0 | 8 | #define vm_ArgumentsObject_inl_h |
michael@0 | 9 | |
michael@0 | 10 | #include "vm/ArgumentsObject.h" |
michael@0 | 11 | |
michael@0 | 12 | #include "vm/ScopeObject.h" |
michael@0 | 13 | |
michael@0 | 14 | #include "jsscriptinlines.h" |
michael@0 | 15 | |
michael@0 | 16 | #include "vm/ScopeObject-inl.h" |
michael@0 | 17 | |
michael@0 | 18 | namespace js { |
michael@0 | 19 | |
michael@0 | 20 | inline const Value & |
michael@0 | 21 | ArgumentsObject::element(uint32_t i) const |
michael@0 | 22 | { |
michael@0 | 23 | JS_ASSERT(!isElementDeleted(i)); |
michael@0 | 24 | const Value &v = data()->args[i]; |
michael@0 | 25 | if (v.isMagic()) { |
michael@0 | 26 | CallObject &callobj = getFixedSlot(MAYBE_CALL_SLOT).toObject().as<CallObject>(); |
michael@0 | 27 | return callobj.aliasedVarFromArguments(v); |
michael@0 | 28 | } |
michael@0 | 29 | return v; |
michael@0 | 30 | } |
michael@0 | 31 | |
michael@0 | 32 | inline void |
michael@0 | 33 | ArgumentsObject::setElement(JSContext *cx, uint32_t i, const Value &v) |
michael@0 | 34 | { |
michael@0 | 35 | JS_ASSERT(!isElementDeleted(i)); |
michael@0 | 36 | HeapValue &lhs = data()->args[i]; |
michael@0 | 37 | if (lhs.isMagic()) { |
michael@0 | 38 | uint32_t slot = lhs.magicUint32(); |
michael@0 | 39 | CallObject &callobj = getFixedSlot(MAYBE_CALL_SLOT).toObject().as<CallObject>(); |
michael@0 | 40 | for (Shape::Range<NoGC> r(callobj.lastProperty()); !r.empty(); r.popFront()) { |
michael@0 | 41 | if (r.front().slot() == slot) { |
michael@0 | 42 | callobj.setAliasedVarFromArguments(cx, lhs, r.front().propid(), v); |
michael@0 | 43 | return; |
michael@0 | 44 | } |
michael@0 | 45 | } |
michael@0 | 46 | MOZ_ASSUME_UNREACHABLE("Bad Arguments::setElement"); |
michael@0 | 47 | } |
michael@0 | 48 | lhs = v; |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | inline bool |
michael@0 | 52 | ArgumentsObject::maybeGetElements(uint32_t start, uint32_t count, Value *vp) |
michael@0 | 53 | { |
michael@0 | 54 | JS_ASSERT(start + count >= start); |
michael@0 | 55 | |
michael@0 | 56 | uint32_t length = initialLength(); |
michael@0 | 57 | if (start > length || start + count > length || isAnyElementDeleted()) |
michael@0 | 58 | return false; |
michael@0 | 59 | |
michael@0 | 60 | for (uint32_t i = start, end = start + count; i < end; ++i, ++vp) |
michael@0 | 61 | *vp = element(i); |
michael@0 | 62 | return true; |
michael@0 | 63 | } |
michael@0 | 64 | |
michael@0 | 65 | } /* namespace js */ |
michael@0 | 66 | |
michael@0 | 67 | #endif /* vm_ArgumentsObject_inl_h */ |