Remove the now-unused JSGlobalObjectTask class
https://bugs.webkit.org/show_bug.cgi?id=235675

Patch by Alexey Shvayka <ashvayka@apple.com> on 2022-01-26
Reviewed by Darin Adler.

It was named quite poorly and replaced with JSMicrotaskCallback.

No new tests, no behavior change.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMGlobalObjectTask.cpp: Removed.
* bindings/js/JSDOMGlobalObjectTask.h: Removed.
* bindings/js/JSDOMWindowBase.cpp:
* bindings/js/JSWorkerGlobalScopeBase.cpp:
* bindings/js/JSWorkletGlobalScopeBase.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@288661 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 5a8a825..6db727f 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2022-01-26  Alexey Shvayka  <ashvayka@apple.com>
+
+        Remove the now-unused JSGlobalObjectTask class
+        https://bugs.webkit.org/show_bug.cgi?id=235675
+
+        Reviewed by Darin Adler.
+
+        It was named quite poorly and replaced with JSMicrotaskCallback.
+
+        No new tests, no behavior change.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSDOMGlobalObjectTask.cpp: Removed.
+        * bindings/js/JSDOMGlobalObjectTask.h: Removed.
+        * bindings/js/JSDOMWindowBase.cpp:
+        * bindings/js/JSWorkerGlobalScopeBase.cpp:
+        * bindings/js/JSWorkletGlobalScopeBase.cpp:
+
 2022-01-26  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, reverting r288614.
diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt
index 65ab0f9..2fec98b 100644
--- a/Source/WebCore/Sources.txt
+++ b/Source/WebCore/Sources.txt
@@ -524,7 +524,6 @@
 bindings/js/JSDOMConvertWebGL.cpp
 bindings/js/JSDOMExceptionHandling.cpp
 bindings/js/JSDOMGlobalObject.cpp
-bindings/js/JSDOMGlobalObjectTask.cpp
 bindings/js/JSDOMGuardedObject.cpp
 bindings/js/JSDOMIterator.cpp
 bindings/js/JSDOMMapLike.cpp
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index 234aba3..9d6b213 100644
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -2434,7 +2434,6 @@
 		7C1E8D011ED0C2DA00B1D983 /* CallbackResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C1E8D001ED0C2BE00B1D983 /* CallbackResult.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		7C1E97281A9F9834007BF0FB /* AutoFillButtonElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C1E97261A9F9834007BF0FB /* AutoFillButtonElement.h */; };
 		7C1F5D591F22FF7300A8874F /* JSDOMConvertScheduledAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C1F5D581F22FF7300A8874F /* JSDOMConvertScheduledAction.h */; };
-		7C2BDD3E17C7F98C0038FF15 /* JSDOMGlobalObjectTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C2BDD3C17C7F98B0038FF15 /* JSDOMGlobalObjectTask.h */; };
 		7C2FA6121EA95A3C00A03108 /* ResourceCryptographicDigest.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C2FA6101EA95A3200A03108 /* ResourceCryptographicDigest.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		7C30D9841F815AEC00268356 /* JSAbortController.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C30D9801F815AC100268356 /* JSAbortController.h */; };
 		7C30D9861F815AEC00268356 /* JSAbortSignal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C30D9811F815AC100268356 /* JSAbortSignal.h */; };
@@ -11597,8 +11596,6 @@
 		7C1E97251A9F9834007BF0FB /* AutoFillButtonElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AutoFillButtonElement.cpp; sourceTree = "<group>"; };
 		7C1E97261A9F9834007BF0FB /* AutoFillButtonElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoFillButtonElement.h; sourceTree = "<group>"; };
 		7C1F5D581F22FF7300A8874F /* JSDOMConvertScheduledAction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSDOMConvertScheduledAction.h; sourceTree = "<group>"; };
-		7C2BDD3B17C7F98B0038FF15 /* JSDOMGlobalObjectTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMGlobalObjectTask.cpp; sourceTree = "<group>"; };
-		7C2BDD3C17C7F98B0038FF15 /* JSDOMGlobalObjectTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMGlobalObjectTask.h; sourceTree = "<group>"; };
 		7C2D7229250838B000539662 /* GlobalEventHandlers+CSSTransitions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = "GlobalEventHandlers+CSSTransitions.idl"; sourceTree = "<group>"; };
 		7C2D722C2508396300539662 /* GlobalEventHandlers+CSSAnimations.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = "GlobalEventHandlers+CSSAnimations.idl"; sourceTree = "<group>"; };
 		7C2D722E25083A3400539662 /* GlobalEventHandlers+PointerEvents.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = "GlobalEventHandlers+PointerEvents.idl"; sourceTree = "<group>"; };
@@ -29263,8 +29260,6 @@
 				E1C36CBC0EB08062007410BC /* JSDOMGlobalObject.cpp */,
 				E1C36C020EB076D6007410BC /* JSDOMGlobalObject.h */,
 				E33D0CBC2672E1B30074E183 /* JSDOMGlobalObjectInlines.h */,
-				7C2BDD3B17C7F98B0038FF15 /* JSDOMGlobalObjectTask.cpp */,
-				7C2BDD3C17C7F98B0038FF15 /* JSDOMGlobalObjectTask.h */,
 				41A1B01B1E542396007F3769 /* JSDOMGuardedObject.cpp */,
 				41A1B01A1E542396007F3769 /* JSDOMGuardedObject.h */,
 				4138F8551D253EEE001CB61E /* JSDOMIterator.cpp */,
@@ -35270,7 +35265,6 @@
 				2E0888D51148848A00AF4265 /* JSDOMFormData.h in Headers */,
 				E1C36C030EB076D6007410BC /* JSDOMGlobalObject.h in Headers */,
 				E33D0CBE2672E1B60074E183 /* JSDOMGlobalObjectInlines.h in Headers */,
-				7C2BDD3E17C7F98C0038FF15 /* JSDOMGlobalObjectTask.h in Headers */,
 				41A1B01C1E54239B007F3769 /* JSDOMGuardedObject.h in Headers */,
 				65DF31F809D1CC60000BE325 /* JSDOMImplementation.h in Headers */,
 				4138F8581D253F0E001CB61E /* JSDOMIterator.h in Headers */,
diff --git a/Source/WebCore/bindings/js/JSDOMGlobalObjectTask.cpp b/Source/WebCore/bindings/js/JSDOMGlobalObjectTask.cpp
deleted file mode 100644
index f120848..0000000
--- a/Source/WebCore/bindings/js/JSDOMGlobalObjectTask.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "JSDOMGlobalObjectTask.h"
-
-#include "ActiveDOMCallback.h"
-#include "JSDOMGlobalObject.h"
-#include "JSExecState.h"
-#include <JavaScriptCore/Microtask.h>
-#include <JavaScriptCore/StrongInlines.h>
-#include <wtf/Ref.h>
-
-namespace WebCore {
-using namespace JSC;
-
-class JSGlobalObjectCallback final : public RefCounted<JSGlobalObjectCallback>, private ActiveDOMCallback {
-public:
-    static Ref<JSGlobalObjectCallback> create(JSDOMGlobalObject& globalObject, Ref<JSC::Microtask>&& task)
-    {
-        return adoptRef(*new JSGlobalObjectCallback(globalObject, WTFMove(task)));
-    }
-
-    void call()
-    {
-        if (!canInvokeCallback())
-            return;
-
-        Ref<JSGlobalObjectCallback> protectedThis(*this);
-        VM& vm = m_globalObject->vm();
-        JSLockHolder lock(vm);
-        auto scope = DECLARE_THROW_SCOPE(vm);
-
-        JSGlobalObject* lexicalGlobalObject = m_globalObject.get();
-
-        ScriptExecutionContext* context = m_globalObject->scriptExecutionContext();
-        // We will fail to get the context if the frame has been detached.
-        if (!context)
-            return;
-        JSExecState::runTask(lexicalGlobalObject, m_task);
-        scope.assertNoExceptionExceptTermination();
-    }
-
-private:
-    JSGlobalObjectCallback(JSDOMGlobalObject& globalObject, Ref<JSC::Microtask>&& task)
-        : ActiveDOMCallback { globalObject.scriptExecutionContext() }
-        , m_globalObject { globalObject.vm(), &globalObject }
-        , m_task { WTFMove(task) }
-    {
-    }
-
-    Strong<JSDOMGlobalObject> m_globalObject;
-    Ref<JSC::Microtask> m_task;
-};
-
-JSGlobalObjectTask::JSGlobalObjectTask(JSDOMGlobalObject& globalObject, Ref<JSC::Microtask>&& task)
-    : ScriptExecutionContext::Task({ })
-{
-    auto callback = JSGlobalObjectCallback::create(globalObject, WTFMove(task));
-    m_task = [callback = WTFMove(callback)] (ScriptExecutionContext&) {
-        callback->call();
-    };
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/JSDOMGlobalObjectTask.h b/Source/WebCore/bindings/js/JSDOMGlobalObjectTask.h
deleted file mode 100644
index 4455ab1..0000000
--- a/Source/WebCore/bindings/js/JSDOMGlobalObjectTask.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "ScriptExecutionContext.h"
-
-namespace JSC {
-class Microtask;
-}
-
-namespace WebCore {
-
-class JSDOMGlobalObject;
-
-class JSGlobalObjectTask : public ScriptExecutionContext::Task {
-public:
-    JSGlobalObjectTask(JSDOMGlobalObject&, Ref<JSC::Microtask>&&);
-};
-
-} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
index 4d92717..06abc44 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
+++ b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
@@ -36,7 +36,6 @@
 #include "Frame.h"
 #include "InspectorController.h"
 #include "JSDOMBindingSecurity.h"
-#include "JSDOMGlobalObjectTask.h"
 #include "JSDOMWindowCustom.h"
 #include "JSDocument.h"
 #include "JSFetchResponse.h"
diff --git a/Source/WebCore/bindings/js/JSWorkerGlobalScopeBase.cpp b/Source/WebCore/bindings/js/JSWorkerGlobalScopeBase.cpp
index 77301a5..96cdf6e0 100644
--- a/Source/WebCore/bindings/js/JSWorkerGlobalScopeBase.cpp
+++ b/Source/WebCore/bindings/js/JSWorkerGlobalScopeBase.cpp
@@ -30,7 +30,6 @@
 
 #include "DOMWrapperWorld.h"
 #include "EventLoop.h"
-#include "JSDOMGlobalObjectTask.h"
 #include "JSDOMGuardedObject.h"
 #include "JSMicrotaskCallback.h"
 #include "WorkerGlobalScope.h"
diff --git a/Source/WebCore/bindings/js/JSWorkletGlobalScopeBase.cpp b/Source/WebCore/bindings/js/JSWorkletGlobalScopeBase.cpp
index a798e42..098bf63 100644
--- a/Source/WebCore/bindings/js/JSWorkletGlobalScopeBase.cpp
+++ b/Source/WebCore/bindings/js/JSWorkletGlobalScopeBase.cpp
@@ -28,7 +28,6 @@
 #include "JSWorkletGlobalScopeBase.h"
 
 #include "DOMWrapperWorld.h"
-#include "JSDOMGlobalObjectTask.h"
 #include "JSDOMGuardedObject.h"
 #include "WorkerOrWorkletScriptController.h"
 #include "WorkletGlobalScope.h"