Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the requestidlecallback IDL file #9825

22 changes: 22 additions & 0 deletions interfaces/requestidlecallback.idl
@@ -0,0 +1,22 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Cooperative Scheduling of Background Tasks" spec.
// See: https://w3c.github.io/requestidlecallback/

partial interface Window {
unsigned long requestIdleCallback(IdleRequestCallback callback,
optional IdleRequestOptions options);
void cancelIdleCallback(unsigned long handle);
};

dictionary IdleRequestOptions {
unsigned long timeout;
};

[Exposed=Window]
interface IdleDeadline {
DOMHighResTimeStamp timeRemaining();
readonly attribute boolean didTimeout;
};

callback IdleRequestCallback = void (IdleDeadline deadline);
53 changes: 0 additions & 53 deletions requestidlecallback/idlharness.html

This file was deleted.

29 changes: 29 additions & 0 deletions requestidlecallback/idlharness.window.js
@@ -0,0 +1,29 @@
// 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 {
requestIdleCallback(this.step_func(d => {
deadline = d;
execIDLTest();
}));
}
});
}, 'IdleDeadline object setup');