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

Revert "Add Symbol.toStringTag to jsg::Objects" #2797

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions src/workerd/api/tests/global-scope-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]'
);
},
};
5 changes: 0 additions & 5 deletions src/workerd/jsg/jsg-test.c++
Original file line number Diff line number Diff line change
Expand Up @@ -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<Other> constructor() {
return jsg::alloc<Other>();
}
JSG_RESOURCE_TYPE(Other) {}
};

Expand Down Expand Up @@ -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");
}

// ========================================================================================
Expand Down
5 changes: 1 addition & 4 deletions src/workerd/jsg/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<typename T::jsgThis, T>(),
"Name passed to JSG_RESOURCE_TYPE() must be the class's own name.");
Expand Down
Loading