Before bug 2010890, the data argument was a UTF8String and any object was stringified by the WebIDL layer. After changing the type to (UTF8String or object), a non-plain object (e.g. a TypeError from info(ex)) is routed to the object branch and passed to JS::ToJSONMaybeSafely, which asserts that the top-level value is a plain object or array. Check the object's ESClass first and fall back to a text marker using the object's string form when it is not a plain object. Differential Revision: https://phabricator.services.mozilla.com/D295309