From 3b5d1f028bbcda214f23e82fa39f0c8a0340cda4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Somhairle=20MacLe=C3=B2id?= Date: Wed, 25 Sep 2024 14:12:45 +0100 Subject: [PATCH] Revert "Add Symbol.toStringTag to jsg::Objects" --- src/workerd/api/tests/global-scope-test.js | 17 ----------------- src/workerd/jsg/jsg-test.c++ | 5 ----- src/workerd/jsg/resource.h | 5 +---- 3 files changed, 1 insertion(+), 26 deletions(-) diff --git a/src/workerd/api/tests/global-scope-test.js b/src/workerd/api/tests/global-scope-test.js index 7ddff4da3da..41670ed6778 100644 --- a/src/workerd/api/tests/global-scope-test.js +++ b/src/workerd/api/tests/global-scope-test.js @@ -723,20 +723,3 @@ export const queueMicrotaskError = { await promise; }, }; - -export const toStringTag = { - test() { - strictEqual('Response', Response.prototype[Symbol.toStringTag]); - strictEqual('Request', Request.prototype[Symbol.toStringTag]); - strictEqual('Headers', Headers.prototype[Symbol.toStringTag]); - strictEqual( - 'URLSearchParams', - URLSearchParams.prototype[Symbol.toStringTag] - ); - strictEqual('CryptoKey', CryptoKey.prototype[Symbol.toStringTag]); - strictEqual( - toString.call(new URLSearchParams()), - '[object URLSearchParams]' - ); - }, -}; diff --git a/src/workerd/jsg/jsg-test.c++ b/src/workerd/jsg/jsg-test.c++ index 88f40e59e6b..1cd5b53dad9 100644 --- a/src/workerd/jsg/jsg-test.c++ +++ b/src/workerd/jsg/jsg-test.c++ @@ -61,9 +61,6 @@ KJ_TEST("context type is exposed in the global scope") { struct InheritContext: public ContextGlobalObject { struct Other: public Object { - static jsg::Ref constructor() { - return jsg::alloc(); - } JSG_RESOURCE_TYPE(Other) {} }; @@ -115,8 +112,6 @@ KJ_TEST("inheritance") { e.expectEval("newExtendedAsBase(123, 'foo') instanceof NumberBox", "boolean", "true"); e.expectEval("newExtendedAsBase(123, 'foo') instanceof ExtendedNumberBox", "boolean", "true"); - - e.expectEval("(new Other())[Symbol.toStringTag]", "string", "Other"); } // ======================================================================================== diff --git a/src/workerd/jsg/resource.h b/src/workerd/jsg/resource.h index 6e480c787a9..ad2e8d6fc5b 100644 --- a/src/workerd/jsg/resource.h +++ b/src/workerd/jsg/resource.h @@ -1531,10 +1531,7 @@ class ResourceWrapper { instance->SetInternalFieldCount(Wrappable::INTERNAL_FIELD_COUNT); - auto classname = v8StrIntern(isolate, typeName(typeid(T))); - - prototype->Set(v8::Symbol::GetToStringTag(isolate), classname, v8::PropertyAttribute::DontEnum); - constructor->SetClassName(classname); + constructor->SetClassName(v8StrIntern(isolate, typeName(typeid(T)))); static_assert(kj::isSameType(), "Name passed to JSG_RESOURCE_TYPE() must be the class's own name.");