mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Update web-platform-tests to revision 58eb04cecbbec2e18531ab440225e38944a9c444
This commit is contained in:
parent
25e8bf69e6
commit
665817d2a6
35333 changed files with 1818077 additions and 16036 deletions
|
@ -5,38 +5,6 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
|
||||
async_test(function() {
|
||||
// Check that two separate calls to requestIdleCallbacks can run in the same
|
||||
// idle period.
|
||||
var callback_1_deadline;
|
||||
var callback_1_has_run = false;
|
||||
var callback_1 = function(deadline) {
|
||||
callback_1_has_run = true;
|
||||
var remaining = deadline.timeRemaining();
|
||||
if (remaining >= 5) {
|
||||
// Should be enough time to run the next callback in the current idle
|
||||
// period.
|
||||
callback_1_deadline = performance.now() + remaining;
|
||||
}
|
||||
};
|
||||
var callback_2 = this.step_func(function(deadline) {
|
||||
assert_true(callback_1_has_run, "Should run callbacks in order of posting if they don't have a timeout.");
|
||||
if (callback_1_deadline != undefined) {
|
||||
assert_true(performance.now() < callback_1_deadline, "Should be able to run both callbacks in the same idle period.");
|
||||
this.done();
|
||||
} else {
|
||||
// Might not have had enough idle time, so try again.
|
||||
callback_1_has_run = false;
|
||||
setTimeout(function() {
|
||||
requestIdleCallback(callback_1);
|
||||
requestIdleCallback(callback_2);
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
requestIdleCallback(callback_1);
|
||||
requestIdleCallback(callback_2);
|
||||
}, 'requestIdleCallback can run multiple different requestIdleCallback callbacks in the same idle period.');
|
||||
|
||||
async_test(function() {
|
||||
// Check that if an idle callback calls requestIdleCallback, the new callback
|
||||
// doesn't get the same deadline (i.e., runs in a new idle period).
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>requestIdleCallback on removed frame shouldn't call back</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script>
|
||||
async_test(function (t) {
|
||||
assert_false(document.hidden, "document.hidden must exist and be false to run this test properly");
|
||||
|
||||
function start() {
|
||||
var frame = document.createElement('iframe');
|
||||
frame.addEventListener('load', _ => connect(frame), {once:true});
|
||||
frame.src = "about:blank";
|
||||
document.body.appendChild(frame);
|
||||
}
|
||||
|
||||
function connect(frame) {
|
||||
var contentWindow = frame.contentWindow;
|
||||
contentWindow.requestIdleCallback(_ => callback0(frame, contentWindow));
|
||||
t.step_timeout(function() { t.done(); }, 1000);
|
||||
}
|
||||
|
||||
function callback0(f, w) {
|
||||
document.body.removeChild(f);
|
||||
w.requestIdleCallback(t.unreached_func("requestIdleCallback callback should not trigger the callback"));
|
||||
}
|
||||
|
||||
addEventListener('load', start, {once:true});
|
||||
}, "calling requestIdleCallback on a contentWindow from a removed iframe should not trigger the callback");
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue