Closed Bug 1277801 Opened 5 years ago Closed 6 months ago

Remove Object.prototype.toString classname fallback


(Core :: JavaScript: Standard Library, task, P3)




Tracking Status
firefox60 --- wontfix
firefox78 --- fixed


(Reporter: evilpie, Assigned: evilpie)


(Blocks 2 open bugs)



(2 files, 1 obsolete file)

We should stop looking at the JSClass' name in Object.prototype.toString.
Blocks: es6
After we fix that we can remove the hack where we set the name to js_Object_str.
Priority: -- → P3
Use "[object Object]" as the default builtin tag, and return the builtin
tag if the object doesn't have a string in its @@toStringTag property.
Update tests to check for the standard behavior.
Attachment #8981299 - Flags: review?(evilpies)
Attachment #8981299 - Flags: review?(evilpies)
I overlooked the related bug for DOM objects, so this patch isn't ready yet (it should work for JS primitive types, but it makes toString return "[object Object]" for DOM objects).
Type: defect → task
Keywords: site-compat
Depends on: 1632468
Depends on: 1632683
Assignee: nobody → evilpies
Attachment #8981299 - Attachment is obsolete: true

test_xrayToJS.xhtml uses the fact that we used to get [object Opaque] for objects that are non-xrayable and thus get the OpaqueXrayTraits class. I don't see anything obvious to replace this check with.

With the following changes Object.prototype.toString is not using the JSClass' name
anymore. This means we now fail to detect opaque wrappers, because they just get the default string: [object Object]

Pushed by
Introduce Cu.isOpaqueWrapper. r=peterv
Remove Object.prototype.toString classname fallback. r=jwalden
Blocks: 1637078
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
Keywords: site-compat
Blocks: 1650178
You need to log in before you can comment on or make changes to this bug.