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_DateObject_h_
8 #define vm_DateObject_h_
10 #include "jsobj.h"
12 #include "js/Value.h"
14 namespace js {
16 class DateTimeInfo;
18 class DateObject : public JSObject
19 {
20 static const uint32_t UTC_TIME_SLOT = 0;
21 static const uint32_t TZA_SLOT = 1;
23 /*
24 * Cached slots holding local properties of the date.
25 * These are undefined until the first actual lookup occurs
26 * and are reset to undefined whenever the date's time is modified.
27 */
28 static const uint32_t COMPONENTS_START_SLOT = 2;
30 static const uint32_t LOCAL_TIME_SLOT = COMPONENTS_START_SLOT + 0;
31 static const uint32_t LOCAL_YEAR_SLOT = COMPONENTS_START_SLOT + 1;
32 static const uint32_t LOCAL_MONTH_SLOT = COMPONENTS_START_SLOT + 2;
33 static const uint32_t LOCAL_DATE_SLOT = COMPONENTS_START_SLOT + 3;
34 static const uint32_t LOCAL_DAY_SLOT = COMPONENTS_START_SLOT + 4;
35 static const uint32_t LOCAL_HOURS_SLOT = COMPONENTS_START_SLOT + 5;
36 static const uint32_t LOCAL_MINUTES_SLOT = COMPONENTS_START_SLOT + 6;
37 static const uint32_t LOCAL_SECONDS_SLOT = COMPONENTS_START_SLOT + 7;
39 static const uint32_t RESERVED_SLOTS = LOCAL_SECONDS_SLOT + 1;
41 public:
42 static const Class class_;
44 inline const js::Value &UTCTime() const {
45 return getFixedSlot(UTC_TIME_SLOT);
46 }
48 // Set UTC time to a given time and invalidate cached local time.
49 void setUTCTime(double t, Value *vp = nullptr);
51 inline double cachedLocalTime(DateTimeInfo *dtInfo);
53 // Cache the local time, year, month, and so forth of the object.
54 // If UTC time is not finite (e.g., NaN), the local time
55 // slots will be set to the UTC time without conversion.
56 void fillLocalTimeSlots(DateTimeInfo *dtInfo);
58 static MOZ_ALWAYS_INLINE bool getTime_impl(JSContext *cx, CallArgs args);
59 static MOZ_ALWAYS_INLINE bool getYear_impl(JSContext *cx, CallArgs args);
60 static MOZ_ALWAYS_INLINE bool getFullYear_impl(JSContext *cx, CallArgs args);
61 static MOZ_ALWAYS_INLINE bool getUTCFullYear_impl(JSContext *cx, CallArgs args);
62 static MOZ_ALWAYS_INLINE bool getMonth_impl(JSContext *cx, CallArgs args);
63 static MOZ_ALWAYS_INLINE bool getUTCMonth_impl(JSContext *cx, CallArgs args);
64 static MOZ_ALWAYS_INLINE bool getDate_impl(JSContext *cx, CallArgs args);
65 static MOZ_ALWAYS_INLINE bool getUTCDate_impl(JSContext *cx, CallArgs args);
66 static MOZ_ALWAYS_INLINE bool getDay_impl(JSContext *cx, CallArgs args);
67 static MOZ_ALWAYS_INLINE bool getUTCDay_impl(JSContext *cx, CallArgs args);
68 static MOZ_ALWAYS_INLINE bool getHours_impl(JSContext *cx, CallArgs args);
69 static MOZ_ALWAYS_INLINE bool getUTCHours_impl(JSContext *cx, CallArgs args);
70 static MOZ_ALWAYS_INLINE bool getMinutes_impl(JSContext *cx, CallArgs args);
71 static MOZ_ALWAYS_INLINE bool getUTCMinutes_impl(JSContext *cx, CallArgs args);
72 static MOZ_ALWAYS_INLINE bool getUTCSeconds_impl(JSContext *cx, CallArgs args);
73 static MOZ_ALWAYS_INLINE bool getUTCMilliseconds_impl(JSContext *cx, CallArgs args);
74 static MOZ_ALWAYS_INLINE bool getTimezoneOffset_impl(JSContext *cx, CallArgs args);
75 };
77 } // namespace js
79 #endif // vm_DateObject_h_