Bug 1539463 [wpt PR 16033] - [idle] Add a threshold minimum of 60 seconds in IdleDetector, a=testonly

Automatic update from web-platform-tests
[idle] Add a threshold minimum of 60 seconds in IdleDetector

This change adds a minimum threshold of 60 seconds to prevent sites from
observing user signals such as typing cadence, or identifying users
with physical or cognitive imparments that may require more time to
interact with user agents and content.

Bug: 939883
Change-Id: I3ab19b2f7d6711c14356575d338819f501eafb9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1535286
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#643965}

--

wpt-commits: ea7981d4c3eb888bcc3d19b0270937c06b92e4f6
wpt-pr: 16033
This commit is contained in:
Ayu Ishii 2019-04-18 11:54:59 +00:00 коммит произвёл James Graham
Родитель b5d8c468c5
Коммит 59a78c104f
3 изменённых файлов: 28 добавлений и 12 удалений

Просмотреть файл

@ -24,7 +24,7 @@ promise_test(async t => {
new IdleDetector({
get threshold() {
used = true;
return 1;
return 60;
}
});
@ -34,12 +34,29 @@ promise_test(async t => {
promise_test(async t => {
try {
new IdleDetector({threshold: 0});
assert_unreached('Threshold of 0 should reject');
assert_unreached('Threshold under 60 should reject');
} catch (error) {
assert_equals(error.name, 'TypeError');
}
}, 'constructor throws with invalid threshold (0)');
promise_test(async t => {
try {
new IdleDetector({threshold: 59});
assert_unreached('Threshold under 60 should reject');
} catch (error) {
assert_equals(error.name, 'TypeError');
}
}, 'constructor throws with threshold below minimum (59)');
promise_test(async t => {
new IdleDetector({threshold: 60});
}, 'constructor allows threshold (60)');
promise_test(async t => {
new IdleDetector({threshold: 61});
}, 'constructor allows threshold (61)');
promise_test(async t => {
try {
new IdleDetector({threshold: null});
@ -75,4 +92,3 @@ promise_test(async t => {
new IdleDetector({threshold: undefined});
}, 'constructor uses a default value for the threshold');

Просмотреть файл

@ -19,7 +19,7 @@ promise_test(async (t) => {
idl_array.add_dependency_idls(dom);
idl_array.add_dependency_idls(html);
self.idle = new IdleDetector({threshold: 1});
self.idle = new IdleDetector({threshold: 60});
let watcher = new EventWatcher(t, self.idle, ["change"]);

Просмотреть файл

@ -23,7 +23,7 @@ promise_test(async t => {
});
});
let detector = new IdleDetector({threshold: 10});
let detector = new IdleDetector({threshold: 60});
let watcher = new EventWatcher(t, detector, ["change"]);
@ -59,7 +59,7 @@ promise_test(async t => {
return first;
});
let detector = new IdleDetector({threshold: 10});
let detector = new IdleDetector({threshold: 60});
let watcher = new EventWatcher(t, detector, ["change"]);
@ -106,7 +106,7 @@ promise_test(async t => {
return first;
});
let detector = new IdleDetector({threshold: 10});
let detector = new IdleDetector({threshold: 60});
let watcher = new EventWatcher(t, detector, ["change"]);
@ -137,7 +137,7 @@ promise_test(async t => {
});
});
let detector = new IdleDetector({threshold: 10});
let detector = new IdleDetector({threshold: 60});
let watcher = new EventWatcher(t, detector, ["change"]);
@ -161,7 +161,7 @@ promise_test(async t => {
});
});
let detector = new IdleDetector({threshold: 10});
let detector = new IdleDetector({threshold: 60});
let event = new Promise((resolve, reject) => {
detector.onchange = resolve;
@ -188,7 +188,7 @@ promise_test(async t => {
});
});
let detector = new IdleDetector({threshold: 10});
let detector = new IdleDetector({threshold: 60});
let watcher = new EventWatcher(t, detector, ["change"]);
@ -220,7 +220,7 @@ promise_test(async t => {
});
});
let detector = new IdleDetector({threshold: 10});
let detector = new IdleDetector({threshold: 60});
// Calling stop() before start() is a no-op.
detector.stop();
@ -247,7 +247,7 @@ promise_test(async t => {
});
});
let detector = new IdleDetector({threshold: 10});
let detector = new IdleDetector({threshold: 60});
let watcher = new EventWatcher(t, detector, ["change"]);