mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 21:58:41 +02:00
Automatic update from web-platform-testsUpdate the requestidlecallback IDL test (#9825) -- wpt-commits: b1681c1d32cf1ca384b094dc9a7f2f7691a87f1c wpt-pr: 9825
30 lines
952 B
JavaScript
30 lines
952 B
JavaScript
// META: script=/resources/WebIDLParser.js
|
|
// META: script=/resources/idlharness.js
|
|
|
|
async_test(function() {
|
|
const srcs = ['requestidlecallback', 'html', 'dom'];
|
|
Promise.all(srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())))
|
|
.then(([idl, html, dom]) => {
|
|
var idl_array = new IdlArray();
|
|
idl_array.add_idls(idl);
|
|
idl_array.add_dependency_idls(html);
|
|
idl_array.add_dependency_idls(dom);
|
|
idl_array.add_objects({Window: ['window']});
|
|
|
|
let deadline;
|
|
const execIDLTest = this.step_func_done(function() {
|
|
idl_array.add_objects({IdleDeadline: [deadline]});
|
|
idl_array.test();
|
|
});
|
|
|
|
if (!window.requestIdleCallback) {
|
|
execIDLTest();
|
|
} else {
|
|
const callback = this.step_func(d => {
|
|
deadline = d;
|
|
execIDLTest();
|
|
});
|
|
requestIdleCallback(callback, { timeout: 100 });
|
|
}
|
|
});
|
|
}, 'IdleDeadline object setup');
|