Update the requestidlecallback IDL test (#9825)

diff --git a/interfaces/requestidlecallback.idl b/interfaces/requestidlecallback.idl
new file mode 100644
index 0000000..195f376
--- /dev/null
+++ b/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);
diff --git a/requestidlecallback/idlharness.html b/requestidlecallback/idlharness.html
deleted file mode 100644
index 459ce36..0000000
--- a/requestidlecallback/idlharness.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!doctype html>
-<meta charset=utf-8>
-<title>idlharness test</title>
-<script src=/resources/testharness.js></script>
-<script src=/resources/testharnessreport.js></script>
-<script src="/resources/WebIDLParser.js"></script>
-<script src="/resources/idlharness.js"></script>
-
-<pre id='untested_idl' style='display:none'>
-[Global=Window, Exposed=Window]
-interface Window {
-};
-</pre>
-
-<pre id='idl'>
-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);
-</pre>
-<script>
-  var idl_array = new IdlArray();
-  idl_array.add_untested_idls(document.getElementById("untested_idl").textContent);
-  idl_array.add_idls(document.getElementById("idl").textContent);
-  idl_array.add_objects({Window: ["window"]});
-
-  async_test(function() {
-    var rIC = this.step_func(function(deadline) {
-      idl_array.add_objects({IdleDeadline: [deadline]});
-      idl_array.test();
-      this.done();
-    });
-    if (window.requestIdleCallback) {
-      requestIdleCallback(rIC);
-    } else {
-      idl_array.test();
-      assert_unreached("IdleDeadline not supported");
-      this.done();
-    }
-  }, "IdleDeadline object setup");
-</script>
diff --git a/requestidlecallback/idlharness.window.js b/requestidlecallback/idlharness.window.js
new file mode 100644
index 0000000..2c9f659
--- /dev/null
+++ b/requestidlecallback/idlharness.window.js
@@ -0,0 +1,30 @@
+// 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');