diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp
index f63472e5461..bf83d56ab1b 100644
--- a/Userland/Libraries/LibWeb/HTML/Window.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Window.cpp
@@ -826,22 +826,6 @@ void Window::invoke_idle_callbacks()
}
}
-// https://w3c.github.io/requestidlecallback/#the-cancelidlecallback-method
-void Window::cancel_idle_callback_impl(u32 handle)
-{
- // 1. Let window be this Window object.
- auto& window = *this;
- // 2. Find the entry in either the window's list of idle request callbacks or list of runnable idle callbacks
- // that is associated with the value handle.
- // 3. If there is such an entry, remove it from both window's list of idle request callbacks and the list of runnable idle callbacks.
- window.m_idle_request_callbacks.remove_first_matching([handle](auto& callback) {
- return callback->handle() == handle;
- });
- window.m_runnable_idle_callbacks.remove_first_matching([handle](auto& callback) {
- return callback->handle() == handle;
- });
-}
-
void Window::set_associated_document(DOM::Document& document)
{
m_associated_document = &document;
@@ -932,8 +916,6 @@ WebIDL::ExceptionOr Window::initialize_web_interfaces(Badgehandle() == handle;
+ });
+ m_runnable_idle_callbacks.remove_first_matching([&](auto& callback) {
+ return callback->handle() == handle;
+ });
+}
+
// https://w3c.github.io/selection-api/#dom-window-getselection
JS::GCPtr Window::get_selection() const
{
@@ -1617,16 +1615,6 @@ JS_DEFINE_NATIVE_FUNCTION(Window::queue_microtask)
return JS::js_undefined();
}
-JS_DEFINE_NATIVE_FUNCTION(Window::cancel_idle_callback)
-{
- auto* impl = TRY(impl_from(vm));
- if (!vm.argument_count())
- return vm.throw_completion(JS::ErrorType::BadArgCountOne, "cancelIdleCallback");
- auto id = TRY(vm.argument(0).to_u32(vm));
- impl->cancel_idle_callback_impl(id);
- return JS::js_undefined();
-}
-
// https://html.spec.whatwg.org/multipage/window-object.html#number-of-document-tree-child-browsing-contexts
size_t Window::document_tree_child_browsing_context_count() const
{
diff --git a/Userland/Libraries/LibWeb/HTML/Window.h b/Userland/Libraries/LibWeb/HTML/Window.h
index e0dd30fd57a..1935e630185 100644
--- a/Userland/Libraries/LibWeb/HTML/Window.h
+++ b/Userland/Libraries/LibWeb/HTML/Window.h
@@ -120,8 +120,6 @@ public:
void start_an_idle_period();
- void cancel_idle_callback_impl(u32);
-
AnimationFrameCallbackDriver& animation_frame_callback_driver() { return m_animation_frame_callback_driver; }
// https://html.spec.whatwg.org/multipage/interaction.html#transient-activation
@@ -181,6 +179,7 @@ public:
double device_pixel_ratio() const;
u32 request_idle_callback(WebIDL::CallbackType&, RequestIdleCallback::IdleRequestOptions const&);
+ void cancel_idle_callback(u32 handle);
JS::GCPtr get_selection() const;
@@ -264,8 +263,6 @@ private:
JS_DECLARE_NATIVE_FUNCTION(queue_microtask);
- JS_DECLARE_NATIVE_FUNCTION(cancel_idle_callback);
-
HTML::Location* m_location { nullptr };
// [[CrossOriginPropertyDescriptorMap]], https://html.spec.whatwg.org/multipage/browsers.html#crossoriginpropertydescriptormap
diff --git a/Userland/Libraries/LibWeb/HTML/Window.idl b/Userland/Libraries/LibWeb/HTML/Window.idl
index 69f3a148159..08b093efd63 100644
--- a/Userland/Libraries/LibWeb/HTML/Window.idl
+++ b/Userland/Libraries/LibWeb/HTML/Window.idl
@@ -80,6 +80,7 @@ interface Window : EventTarget {
// https://w3c.github.io/requestidlecallback/#window_extensions
unsigned long requestIdleCallback(IdleRequestCallback callback, optional IdleRequestOptions options = {});
+ undefined cancelIdleCallback(unsigned long handle);
// https://w3c.github.io/selection-api/#extensions-to-window-interface
Selection? getSelection();