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