зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1692609) for causing failures at test_getUserMedia_addTrackRemoveTrack. CLOSED TREE
Backed out changeset ce4b4f786c4d (bug 1692609) Backed out changeset d36f5f4ece1e (bug 1692609)
This commit is contained in:
Родитель
8bfcc50fc5
Коммит
5d19838121
|
@ -38,12 +38,10 @@ add_task(async function runRTPTestAnimation() {
|
|||
}
|
||||
|
||||
let expectedPrecision = data.precision;
|
||||
var isRounded = function() {
|
||||
return "Placeholder for eslint";
|
||||
};
|
||||
let evalStr = "var isRounded = " + data.isRoundedFunc;
|
||||
// eslint beleives that isrounded is available in this scope, but if you
|
||||
// remove the assignment, you will see it is not
|
||||
// eslint-disable-next-line
|
||||
eval(evalStr);
|
||||
let isRounded = eval(data.isRoundedFunc);
|
||||
|
||||
const testDiv = content.document.getElementById("testDiv");
|
||||
const animation = testDiv.animate({ opacity: [0, 1] }, 100000);
|
||||
|
|
|
@ -12,12 +12,10 @@
|
|||
let runWorkerTest = async function(data) {
|
||||
let expectedPrecision = data.precision;
|
||||
await new Promise(resolve => {
|
||||
var isRounded = function() {
|
||||
return "Placeholder for eslint";
|
||||
};
|
||||
let evalStr = "var isRounded = " + data.isRoundedFunc;
|
||||
// eslint beleives that isrounded is available in this scope, but if you
|
||||
// remove the assignment, you will see it is not
|
||||
// eslint-disable-next-line
|
||||
eval(evalStr);
|
||||
let isRounded = eval(data.isRoundedFunc);
|
||||
|
||||
let worker = new content.Worker(
|
||||
"coop_header.sjs?crossOriginIsolated=true&worker=true"
|
||||
|
|
|
@ -12,12 +12,10 @@
|
|||
add_task(async function runRTPTestDOM() {
|
||||
let runTests = async function(data) {
|
||||
let expectedPrecision = data.precision;
|
||||
var isRounded = function() {
|
||||
return "Placeholder for eslint";
|
||||
};
|
||||
let evalStr = "var isRounded = " + data.isRoundedFunc;
|
||||
// eslint beleives that isrounded is available in this scope, but if you
|
||||
// remove the assignment, you will see it is not
|
||||
// eslint-disable-next-line
|
||||
eval(evalStr);
|
||||
let isRounded = eval(data.isRoundedFunc);
|
||||
|
||||
// Prepare for test of AudioContext.currentTime
|
||||
// eslint-disable-next-line
|
||||
|
@ -77,12 +75,10 @@ add_task(async function runRTPTestDOM() {
|
|||
let runWorkerTest = async function(data) {
|
||||
let expectedPrecision = data.precision;
|
||||
await new Promise(resolve => {
|
||||
var isRounded = function() {
|
||||
return "Placeholder for eslint";
|
||||
};
|
||||
let evalStr = "var isRounded = " + data.isRoundedFunc;
|
||||
// eslint beleives that isrounded is available in this scope, but if you
|
||||
// remove the assignment, you will see it is not
|
||||
// eslint-disable-next-line
|
||||
eval(evalStr);
|
||||
let isRounded = eval(data.isRoundedFunc);
|
||||
|
||||
let worker = new content.Worker(
|
||||
"coop_header.sjs?crossOriginIsolated=true&worker=true"
|
||||
|
|
|
@ -4,12 +4,10 @@ add_task(async function runRPTests() {
|
|||
let runTests = async function(data) {
|
||||
let timerlist = data.list;
|
||||
let expectedPrecision = data.precision;
|
||||
var isRounded = function() {
|
||||
return "Placeholder for eslint";
|
||||
};
|
||||
let evalStr = "var isRounded = " + data.isRoundedFunc;
|
||||
// eslint beleives that isrounded is available in this scope, but if you
|
||||
// remove the assignment, you will see it is not
|
||||
// eslint-disable-next-line
|
||||
eval(evalStr);
|
||||
let isRounded = eval(data.isRoundedFunc);
|
||||
|
||||
ok(
|
||||
isRounded(content.performance.timeOrigin, expectedPrecision),
|
||||
|
@ -106,12 +104,10 @@ add_task(async function runRTPTests() {
|
|||
let runTests = async function(data) {
|
||||
let timerlist = data.list;
|
||||
let expectedPrecision = data.precision;
|
||||
var isRounded = function() {
|
||||
return "Placeholder for eslint";
|
||||
};
|
||||
let evalStr = "var isRounded = " + data.isRoundedFunc;
|
||||
// eslint beleives that isrounded is available in this scope, but if you
|
||||
// remove the assignment, you will see it is not
|
||||
// eslint-disable-next-line
|
||||
eval(evalStr);
|
||||
let isRounded = eval(data.isRoundedFunc);
|
||||
|
||||
ok(
|
||||
isRounded(content.performance.timeOrigin, expectedPrecision),
|
||||
|
|
|
@ -66,12 +66,10 @@ let setupPerformanceAPISpoofAndDisableTest = async function(
|
|||
let tab = await BrowserTestUtils.openNewForegroundTab(win.gBrowser, url);
|
||||
|
||||
// No matter what we set the precision to, if we're in ResistFingerprinting mode
|
||||
// we use the larger of the precision pref and the RFP time-atom constant
|
||||
// we use the larger of the precision pref and the constant 100ms
|
||||
if (resistFingerprinting) {
|
||||
const RFP_TIME_ATOM_MS = 16.667;
|
||||
expectedPrecision = Math.max(RFP_TIME_ATOM_MS, expectedPrecision);
|
||||
expectedPrecision = expectedPrecision < 100 ? 100 : expectedPrecision;
|
||||
}
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
tab.linkedBrowser,
|
||||
[
|
||||
|
@ -96,10 +94,10 @@ let setupPerformanceAPISpoofAndDisableTest = async function(
|
|||
await BrowserTestUtils.closeWindow(win);
|
||||
};
|
||||
|
||||
const isTimeValueRounded = function(x, expectedPrecision) {
|
||||
const nearestExpected = Math.round(x / expectedPrecision) * expectedPrecision;
|
||||
let isTimeValueRounded = (x, expectedPrecision) => {
|
||||
let rounded = Math.floor(x / expectedPrecision) * expectedPrecision;
|
||||
// First we do the perfectly normal check that should work just fine
|
||||
if (x === nearestExpected) {
|
||||
if (rounded === x || x === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -110,22 +108,17 @@ const isTimeValueRounded = function(x, expectedPrecision) {
|
|||
// our epsilon.
|
||||
// To be clear, this error is introduced in our re-calculation of 'rounded'
|
||||
// above in JavaScript.
|
||||
const error = Math.abs(x - nearestExpected);
|
||||
if (Math.abs(error) < 0.0005) {
|
||||
if (Math.abs(rounded - x + expectedPrecision) < 0.0005) {
|
||||
return true;
|
||||
} else if (Math.abs(rounded - x) < 0.0005) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Then we handle the case where you're sub-millisecond and the timer is not
|
||||
// We check that the timer is not sub-millisecond by assuming it is not if it
|
||||
// returns an even number of milliseconds
|
||||
if (
|
||||
Math.round(expectedPrecision) != expectedPrecision &&
|
||||
Math.round(x) == x
|
||||
) {
|
||||
let acceptableIntRounding = false;
|
||||
acceptableIntRounding |= Math.floor(nearestExpected) == x;
|
||||
acceptableIntRounding |= Math.ceil(nearestExpected) == x;
|
||||
if (acceptableIntRounding) {
|
||||
if (expectedPrecision < 1 && Math.round(x) == x) {
|
||||
if (Math.round(rounded) == x) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -136,10 +129,12 @@ const isTimeValueRounded = function(x, expectedPrecision) {
|
|||
expectedPrecision +
|
||||
" Measured Value: " +
|
||||
x +
|
||||
" Nearest Expected Vaue: " +
|
||||
nearestExpected +
|
||||
" Error: " +
|
||||
error
|
||||
" Rounded Vaue: " +
|
||||
rounded +
|
||||
" Fuzzy1: " +
|
||||
Math.abs(rounded - x + expectedPrecision) +
|
||||
" Fuzzy 2: " +
|
||||
Math.abs(rounded - x)
|
||||
);
|
||||
|
||||
return false;
|
||||
|
@ -174,10 +169,9 @@ let setupAndRunCrossOriginIsolatedTest = async function(
|
|||
);
|
||||
|
||||
// No matter what we set the precision to, if we're in ResistFingerprinting
|
||||
// mode we use the larger of the precision pref and the RFP time-atom constant
|
||||
// mode we use the larger of the precision pref and the constant 100ms
|
||||
if (resistFingerprinting) {
|
||||
const RFP_TIME_ATOM_MS = 16.667;
|
||||
expectedPrecision = Math.max(RFP_TIME_ATOM_MS, expectedPrecision);
|
||||
expectedPrecision = expectedPrecision < 100 ? 100 : expectedPrecision;
|
||||
}
|
||||
await SpecialPowers.spawn(
|
||||
tab.linkedBrowser,
|
||||
|
|
|
@ -21,10 +21,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1382545
|
|||
|
||||
function runTest() {
|
||||
// No matter what we set the precision to, if we're in ResistFingerprinting mode
|
||||
// we use the larger of the precision pref and the constant RFP time-atom
|
||||
// we use the larger of the precision pref and the constant 100ms
|
||||
if (resistFingerprinting) {
|
||||
const RFP_TIME_ATOM_MS = 16.667;
|
||||
expectedPrecision = Math.max(1000*RFP_TIME_ATOM_MS, expectedPrecision);
|
||||
expectedPrecision = expectedPrecision < 100000 ? 100000 : expectedPrecision;
|
||||
}
|
||||
window.open("file_animation_api.html");
|
||||
}
|
||||
|
|
|
@ -33,11 +33,10 @@ https://trac.torproject.org/projects/tor/ticket/1517
|
|||
"audioContext.currentTime * 1000",
|
||||
]);
|
||||
|
||||
// From browser/components/resistfingerprinting/test/browser/head.js:
|
||||
function isTimeValueRounded(x, expectedPrecision) {
|
||||
const nearestExpected = Math.round(x / expectedPrecision) * expectedPrecision;
|
||||
let isRounded = (x, expectedPrecision) => {
|
||||
let rounded = (Math.floor(x / expectedPrecision) * expectedPrecision);
|
||||
// First we do the perfectly normal check that should work just fine
|
||||
if (x === nearestExpected)
|
||||
if (rounded === x || x === 0)
|
||||
return true;
|
||||
|
||||
// When we're diving by non-whole numbers, we may not get perfect
|
||||
|
@ -47,29 +46,27 @@ https://trac.torproject.org/projects/tor/ticket/1517
|
|||
// our epsilon.
|
||||
// To be clear, this error is introduced in our re-calculation of 'rounded'
|
||||
// above in JavaScript.
|
||||
const error = Math.abs(x - nearestExpected);
|
||||
if (Math.abs(error) < .0005) {
|
||||
if (Math.abs(rounded - x + expectedPrecision) < .0005) {
|
||||
return true;
|
||||
} else if (Math.abs(rounded - x) < .0005) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Then we handle the case where you're sub-millisecond and the timer is not
|
||||
// We check that the timer is not sub-millisecond by assuming it is not if it
|
||||
// returns an even number of milliseconds
|
||||
if (Math.round(expectedPrecision) != expectedPrecision && Math.round(x) == x) {
|
||||
let acceptableIntRounding = false;
|
||||
acceptableIntRounding |= (Math.floor(nearestExpected) == x);
|
||||
acceptableIntRounding |= (Math.ceil(nearestExpected) == x);
|
||||
if (acceptableIntRounding) {
|
||||
if (expectedPrecision < 1 && Math.round(x) == x) {
|
||||
if (Math.round(rounded) == x) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
ok(false, "Looming Test Failure, Additional Debugging Info: Expected Precision: " + expectedPrecision + " Measured Value: " + x +
|
||||
" Nearest Expected Vaue: " + nearestExpected + " Error: " + error);
|
||||
" Rounded Vaue: " + rounded + " Fuzzy1: " + Math.abs(rounded - x + expectedPrecision) +
|
||||
" Fuzzy 2: " + Math.abs(rounded - x));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// ================================================================================================
|
||||
// ================================================================================================
|
||||
|
@ -82,7 +79,7 @@ https://trac.torproject.org/projects/tor/ticket/1517
|
|||
let timeStamps = event.data;
|
||||
for (let i = 0; i < timeStampCodes.length; i++) {
|
||||
let timeStamp = timeStamps[i];
|
||||
ok(isTimeValueRounded(timeStamp, expectedPrecision),
|
||||
ok(isRounded(timeStamp, expectedPrecision),
|
||||
"pref: " + prefname + " - '" +
|
||||
"'" + timeStampCodes[i] +
|
||||
"' should be rounded to nearest " + expectedPrecision + " ms in workers; saw " +
|
||||
|
@ -119,10 +116,9 @@ https://trac.torproject.org/projects/tor/ticket/1517
|
|||
]});
|
||||
|
||||
// No matter what we set the precision to, if we're in ResistFingerprinting mode
|
||||
// we use the larger of the precision pref and the RFP time-atom constant
|
||||
// we use the larger of the precision pref and the constant 100ms
|
||||
if (resistFingerprinting) {
|
||||
const RFP_TIME_ATOM_MS = 16.667;
|
||||
expectedPrecision = Math.max(RFP_TIME_ATOM_MS, expectedPrecision);
|
||||
expectedPrecision = expectedPrecision < 100 ? 100 : expectedPrecision;
|
||||
}
|
||||
|
||||
let worker2 = new Worker("worker_child.js");
|
||||
|
@ -159,10 +155,9 @@ https://trac.torproject.org/projects/tor/ticket/1517
|
|||
]});
|
||||
|
||||
// No matter what we set the precision to, if we're in ResistFingerprinting mode
|
||||
// we use the larger of the precision pref and the constant RFP time-atom
|
||||
// we use the larger of the precision pref and the constant 100ms
|
||||
if (resistFingerprinting) {
|
||||
const RFP_TIME_ATOM_MS = 16.667;
|
||||
expectedPrecision = Math.max(RFP_TIME_ATOM_MS, expectedPrecision);
|
||||
expectedPrecision = expectedPrecision < 100 ? 100 : expectedPrecision;
|
||||
}
|
||||
|
||||
// Loop through each timeStampCode, evaluate it,
|
||||
|
@ -179,7 +174,7 @@ https://trac.torproject.org/projects/tor/ticket/1517
|
|||
if (timeStampCode.includes("audioContext") && expectedPrecision < 5.4)
|
||||
continue;
|
||||
|
||||
ok(isTimeValueRounded(timeStamp, expectedPrecision),
|
||||
ok(isRounded(timeStamp, expectedPrecision),
|
||||
"pref: " + prefname + " - '" +
|
||||
"'" + timeStampCode +
|
||||
"' should be rounded to nearest " +
|
||||
|
|
|
@ -26,6 +26,7 @@ https://trac.torproject.org/projects/tor/ticket/15757
|
|||
// will be set during MediaTestManager.runTests().
|
||||
gTestPrefs.push(
|
||||
["privacy.resistFingerprinting", true],
|
||||
["privacy.resistFingerprinting.reduceTimerPrecision.microseconds", 100000],
|
||||
["privacy.resistFingerprinting.reduceTimerPrecision.jitter", false],
|
||||
// We use 240p as the target resoultion since 480p is greater than every video
|
||||
// source in our test suite, so we need to use 240p here for allowing us to
|
||||
|
@ -39,10 +40,8 @@ https://trac.torproject.org/projects/tor/ticket/15757
|
|||
];
|
||||
|
||||
function checkStats(v, shouldDrop) {
|
||||
// Rounding the current time to the RFP time-atom.
|
||||
const RFP_TIME_ATOM_MS = 16.667;
|
||||
const timeAtomSecs = RFP_TIME_ATOM_MS / 1000;
|
||||
let currentTime = Math.floor(v.currentTime / timeAtomSecs) * timeAtomSecs;
|
||||
// Rounding the current time to 100ms.
|
||||
let currentTime = Math.floor(v.currentTime * 10) / 10;
|
||||
let dropRate = 0;
|
||||
|
||||
if (shouldDrop) {
|
||||
|
|
|
@ -17,19 +17,8 @@ SoftwareVsyncSource::SoftwareVsyncSource() {
|
|||
}
|
||||
|
||||
SoftwareVsyncSource::~SoftwareVsyncSource() {
|
||||
// VsyncSource::Display must be destroyed on the main thread.
|
||||
// Take a strong-ref and enqueue a task for the main thread to release it.
|
||||
auto strongRef = mGlobalDisplay;
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mGlobalDisplay = nullptr;
|
||||
|
||||
if (!NS_IsMainThread()) {
|
||||
const auto fnRun = [strongRef]() {}; // Copy the strong-ref.
|
||||
strongRef = nullptr;
|
||||
|
||||
already_AddRefed<mozilla::Runnable> runnable =
|
||||
NS_NewRunnableFunction("enqueue ~SoftwareDisplay", fnRun);
|
||||
NS_DispatchToMainThread(std::move(runnable), 0);
|
||||
}
|
||||
}
|
||||
|
||||
SoftwareDisplay::SoftwareDisplay() : mVsyncEnabled(false) {
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "mozilla/StaticPrefs_layout.h"
|
||||
#include "mozilla/StaticPrefs_layers.h"
|
||||
#include "mozilla/StaticPrefs_media.h"
|
||||
#include "mozilla/StaticPrefs_privacy.h"
|
||||
#include "mozilla/StaticPrefs_webgl.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
@ -947,15 +946,9 @@ void gfxPlatform::Init() {
|
|||
}
|
||||
|
||||
gLastUsedFrameRate = ForceSoftwareVsync() ? GetSoftwareVsyncRate() : -1;
|
||||
|
||||
Preferences::RegisterCallback(
|
||||
FrameRatePrefChanged,
|
||||
nsDependentCString(StaticPrefs::GetPrefName_layout_frame_rate()));
|
||||
Preferences::RegisterCallback(
|
||||
FrameRatePrefChanged,
|
||||
nsDependentCString(
|
||||
StaticPrefs::GetPrefName_privacy_resistFingerprinting()));
|
||||
|
||||
// Set up the vsync source for the parent process.
|
||||
ReInitFrameRate();
|
||||
|
||||
|
@ -2997,26 +2990,17 @@ bool gfxPlatform::IsInLayoutAsapMode() {
|
|||
// the second is that the compositor goes ASAP and the refresh driver
|
||||
// goes at whatever the configurated rate is. This only checks the version
|
||||
// talos uses, which is the refresh driver and compositor are in lockstep.
|
||||
// Ignore privacy_resistFingerprinting to preserve ASAP mode there.
|
||||
return StaticPrefs::layout_frame_rate() == 0;
|
||||
}
|
||||
|
||||
static int LayoutFrameRateFromPrefs() {
|
||||
auto val = StaticPrefs::layout_frame_rate();
|
||||
if (StaticPrefs::privacy_resistFingerprinting()) {
|
||||
val = 60;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool gfxPlatform::ForceSoftwareVsync() {
|
||||
return LayoutFrameRateFromPrefs() > 0;
|
||||
return StaticPrefs::layout_frame_rate() > 0;
|
||||
}
|
||||
|
||||
/* static */
|
||||
int gfxPlatform::GetSoftwareVsyncRate() {
|
||||
int preferenceRate = LayoutFrameRateFromPrefs();
|
||||
int preferenceRate = StaticPrefs::layout_frame_rate();
|
||||
if (preferenceRate <= 0) {
|
||||
return gfxPlatform::GetDefaultFrameRate();
|
||||
}
|
||||
|
|
|
@ -159,26 +159,12 @@ nsRFPService* nsRFPService::GetOrCreate() {
|
|||
return sRFPService;
|
||||
}
|
||||
|
||||
constexpr double RFP_TIME_ATOM_MS = 16.667; // 60Hz, 1000/60 but rounded.
|
||||
/*
|
||||
In RFP RAF always runs at 60Hz, so we're ~0.02% off of 1000/60 here.
|
||||
```js
|
||||
extra_frames_per_frame = 16.667 / (1000/60) - 1 // 0.00028
|
||||
sec_per_extra_frame = 1 / (extra_frames_per_frame * 60) // 833.33
|
||||
min_per_extra_frame = sec_per_extra_frame / 60 // 13.89
|
||||
```
|
||||
We expect an extra frame every ~14 minutes, which is enough to be smooth.
|
||||
16.67 would be ~1.4 minutes, which is OK, but is more noticable.
|
||||
Put another way, if this is the only unacceptable hitch you have across 14
|
||||
minutes, I'm impressed, and we might revisit this.
|
||||
*/
|
||||
|
||||
/* static */
|
||||
double nsRFPService::TimerResolution() {
|
||||
double prefValue = StaticPrefs::
|
||||
privacy_resistFingerprinting_reduceTimerPrecision_microseconds();
|
||||
if (StaticPrefs::privacy_resistFingerprinting()) {
|
||||
return std::max(RFP_TIME_ATOM_MS * 1000.0, prefValue);
|
||||
return std::max(100000.0, prefValue);
|
||||
}
|
||||
return prefValue;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче