This commit is contained in:
Simon Knott 2025-02-05 17:04:28 +01:00
parent bb2220e5ed
commit c6f5edcaf3
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -35,17 +35,13 @@ export async function collect(serializers: ReturnType<typeof source>, isFirefox:
function isPlainObject(v: any) {
const ctor = v?.constructor;
if (ctor === Object)
return true;
// firefox bug. the above check doesn't work in the utility world.
if (isFirefox) {
const constructorImpl = ctor?.toString();
if (constructorImpl.startsWith('function Object() {') && constructorImpl.includes(' [native code]'))
if (constructorImpl.startsWith('function Object() {') && constructorImpl.includes('[native code]'))
return true;
}
return false;
return ctor === Object;
}
function trySerialize(value: any): { trivial?: any, encoded?: any } {