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 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include "StartupTimeline.h" |
michael@0 | 6 | #include "mozilla/Telemetry.h" |
michael@0 | 7 | #include "mozilla/TimeStamp.h" |
michael@0 | 8 | #include "nsXULAppAPI.h" |
michael@0 | 9 | |
michael@0 | 10 | namespace mozilla { |
michael@0 | 11 | |
michael@0 | 12 | TimeStamp StartupTimeline::sStartupTimeline[StartupTimeline::MAX_EVENT_ID]; |
michael@0 | 13 | const char *StartupTimeline::sStartupTimelineDesc[StartupTimeline::MAX_EVENT_ID] = { |
michael@0 | 14 | #define mozilla_StartupTimeline_Event(ev, desc) desc, |
michael@0 | 15 | #include "StartupTimeline.h" |
michael@0 | 16 | #undef mozilla_StartupTimeline_Event |
michael@0 | 17 | }; |
michael@0 | 18 | |
michael@0 | 19 | /** |
michael@0 | 20 | * Implementation of XRE_StartupTimelineRecord() |
michael@0 | 21 | * |
michael@0 | 22 | * @param aEvent Same as XRE_StartupTimelineRecord() equivalent argument |
michael@0 | 23 | * @param aWhen Same as XRE_StartupTimelineRecord() equivalent argument |
michael@0 | 24 | */ |
michael@0 | 25 | void |
michael@0 | 26 | StartupTimelineRecordExternal(int aEvent, uint64_t aWhen) |
michael@0 | 27 | { |
michael@0 | 28 | #if XP_WIN |
michael@0 | 29 | TimeStamp ts = TimeStampValue(aWhen, 0, 0); |
michael@0 | 30 | #else |
michael@0 | 31 | TimeStamp ts = TimeStampValue(aWhen); |
michael@0 | 32 | #endif |
michael@0 | 33 | bool error = false; |
michael@0 | 34 | |
michael@0 | 35 | // Since the timestamp comes from an external source validate it before |
michael@0 | 36 | // recording it and log a telemetry error if it appears inconsistent. |
michael@0 | 37 | if (ts < TimeStamp::ProcessCreation(error)) { |
michael@0 | 38 | Telemetry::Accumulate(Telemetry::STARTUP_MEASUREMENT_ERRORS, |
michael@0 | 39 | (StartupTimeline::Event)aEvent); |
michael@0 | 40 | } else { |
michael@0 | 41 | StartupTimeline::Record((StartupTimeline::Event)aEvent, ts); |
michael@0 | 42 | } |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | } /* namespace mozilla */ |
michael@0 | 46 | |
michael@0 | 47 | /** |
michael@0 | 48 | * The XRE_StartupTimeline_Record function is to be used by embedding |
michael@0 | 49 | * applications that can't use mozilla::StartupTimeline::Record() directly. |
michael@0 | 50 | * |
michael@0 | 51 | * It can create timestamps from arbitrary time values and sanitizies them to |
michael@0 | 52 | * ensure that they are not inconsistent with those captured using monotonic |
michael@0 | 53 | * timers. The value of aWhen must have been captured using the same timer |
michael@0 | 54 | * used by the platform's mozilla::TimeStamp implementation. Erroneous values |
michael@0 | 55 | * will be flagged as telemetry errors. |
michael@0 | 56 | * |
michael@0 | 57 | * @param aEvent The event to be recorded, must correspond to an element of the |
michael@0 | 58 | * mozilla::StartupTimeline::Event enumartion |
michael@0 | 59 | * @param aWhen The time at which the event happened, must have been recorded |
michael@0 | 60 | * using the same timer as the platform's mozilla::TimeStamp |
michael@0 | 61 | * implementation |
michael@0 | 62 | */ |
michael@0 | 63 | void |
michael@0 | 64 | XRE_StartupTimelineRecord(int aEvent, PRTime aWhen) |
michael@0 | 65 | { |
michael@0 | 66 | mozilla::StartupTimelineRecordExternal(aEvent, aWhen); |
michael@0 | 67 | } |