Bug 1485264 - Removed dom.event.highrestimestamp.enabled pref r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D21580

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Josef Citrine 2019-03-01 18:49:44 +00:00
parent 9d53cb56b4
commit dde7723c68
6 changed files with 20 additions and 65 deletions

View File

@ -40,9 +40,6 @@
namespace mozilla {
namespace dom {
static bool sReturnHighResTimeStamp = false;
static bool sReturnHighResTimeStampIsSet = false;
Event::Event(EventTarget* aOwner, nsPresContext* aPresContext,
WidgetEvent* aEvent) {
ConstructorInit(aOwner, aPresContext, aEvent);
@ -57,13 +54,6 @@ void Event::ConstructorInit(EventTarget* aOwner, nsPresContext* aPresContext,
SetOwner(aOwner);
mIsMainThreadEvent = NS_IsMainThread();
if (mIsMainThreadEvent && !sReturnHighResTimeStampIsSet) {
Preferences::AddBoolVarCache(&sReturnHighResTimeStamp,
"dom.event.highrestimestamp.enabled",
sReturnHighResTimeStamp);
sReturnHighResTimeStampIsSet = true;
}
mPrivateDataDuplicated = false;
mWantsPopupControlCheck = false;
@ -692,15 +682,6 @@ void Event::SetReturnValue(bool aReturnValue, CallerType aCallerType) {
}
double Event::TimeStamp() {
if (!sReturnHighResTimeStamp) {
// In the situation where you have set a very old, not-very-supported
// non-default preference, we will always reduce the precision,
// regardless of system principal or not.
// The timestamp is absolute, so we supply a zero context mix-in.
double ret = static_cast<double>(mEvent->mTime);
return nsRFPService::ReduceTimePrecisionAsMSecs(ret, 0);
}
if (mEvent->mTimeStamp.IsNull()) {
return 0.0;
}

View File

@ -40,8 +40,7 @@ SimpleTest.requestFlakyTimeout("untriaged");
// This is a known (and accepted) regression of privacy.reduceTimerPrecision so
// we need to turn it off.
SpecialPowers.pushPrefEnv({ "set": [
["privacy.reduceTimerPrecision", false],
["dom.event.highrestimestamp.enabled", true]
["privacy.reduceTimerPrecision", false]
]}, testRegularEvents);
// Event.timeStamp should be relative to the time origin which is:

View File

@ -236,19 +236,15 @@ function sanityCheckEvent(evt)
is(evt.eventPhase, evt.AT_TARGET);
is(evt.bubbles, false, "Event should not bubble");
is(evt.cancelable, false, "Event should not be cancelable");
if (SpecialPowers.getBoolPref("dom.event.highrestimestamp.enabled")) {
var lessThanOrEqualsAllowed = SpecialPowers.getBoolPref("privacy.reduceTimerPrecision");
var now = window.performance.now();
ok(evt.timeStamp > 0 &&
(
(evt.timeStamp < now && !lessThanOrEqualsAllowed) ||
(evt.timeStamp <= now && lessThanOrEqualsAllowed)
),
"Event timeStamp (" + evt.timeStamp + ") should be > 0 but " +
"before the current time (" + now + ")");
} else {
is(evt.timeStamp, 0, "Event timeStamp should be 0");
}
var lessThanOrEqualsAllowed = SpecialPowers.getBoolPref("privacy.reduceTimerPrecision");
var now = window.performance.now();
ok(evt.timeStamp > 0 &&
(
(evt.timeStamp < now && !lessThanOrEqualsAllowed) ||
(evt.timeStamp <= now && lessThanOrEqualsAllowed)
),
"Event timeStamp (" + evt.timeStamp + ") should be > 0 but " +
"before the current time (" + now + ")");
ok(evt.view !== null, "Event view not set");
}

View File

@ -69,21 +69,11 @@ function runTests() {
"input event should be dispatched with InputEvent interface");
ok(!aEvent.cancelable, "input event must not be cancelable");
ok(aEvent.bubbles, "input event must be bubbles");
if (SpecialPowers.getBoolPref("dom.event.highrestimestamp.enabled")) {
let duration = Math.abs(window.performance.now() - aEvent.timeStamp);
ok(duration < 30 * 1000,
"perhaps, timestamp wasn't set correctly :" + aEvent.timeStamp +
" (expected it to be within 30s of the current time but it " +
"differed by " + duration + "ms)");
} else {
var eventTime = new Date(aEvent.timeStamp);
let duration = Math.abs(Date.now() - aEvent.timeStamp);
ok(duration < 30 * 1000,
"perhaps, timestamp wasn't set correctly :" +
eventTime.toLocaleString() +
" (expected it to be within 30s of the current time but it " +
"differed by " + duration + "ms)");
}
let duration = Math.abs(window.performance.now() - aEvent.timeStamp);
ok(duration < 30 * 1000,
"perhaps, timestamp wasn't set correctly :" + aEvent.timeStamp +
" (expected it to be within 30s of the current time but it " +
"differed by " + duration + "ms)");
inputEvent = aEvent;
};

View File

@ -41,21 +41,11 @@ function runTests() {
"input event should be dispatched with InputEvent interface");
ok(!aEvent.cancelable, "input event must not be cancelable");
ok(aEvent.bubbles, "input event must be bubbles");
if (SpecialPowers.getBoolPref("dom.event.highrestimestamp.enabled")) {
let duration = Math.abs(window.performance.now() - aEvent.timeStamp);
ok(duration < 30 * 1000,
"perhaps, timestamp wasn't set correctly :" + aEvent.timeStamp +
" (expected it to be within 30s of the current time but it " +
"differed by " + duration + "ms)");
} else {
var eventTime = new Date(aEvent.timeStamp);
let duration = Math.abs(Date.now() - aEvent.timeStamp);
ok(duration < 30 * 1000,
"perhaps, timestamp wasn't set correctly :" +
eventTime.toLocaleString() +
" (expected it to be within 30s of the current time but it " +
"differed by " + duration + "ms)");
}
let duration = Math.abs(window.performance.now() - aEvent.timeStamp);
ok(duration < 30 * 1000,
"perhaps, timestamp wasn't set correctly :" + aEvent.timeStamp +
" (expected it to be within 30s of the current time but it " +
"differed by " + duration + "ms)");
inputEvent = aEvent;
};

View File

@ -1448,7 +1448,6 @@ pref("privacy.resistFingerprinting.reduceTimerPrecision.jitter", true);
pref("dom.event.contextmenu.enabled", true);
pref("dom.event.clipboardevents.enabled", true);
pref("dom.event.highrestimestamp.enabled", true);
pref("dom.event.coalesce_mouse_move", true);
pref("javascript.enabled", true);