Closed Bug 1277801 Opened 8 years ago Closed 5 years ago

Remove Object.prototype.toString classname fallback

Categories

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

task

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox60 --- wontfix
firefox78 --- fixed

People

(Reporter: evilpie, Assigned: evilpie)

References

(Blocks 2 open bugs)

Details

Attachments

(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

Similar to a patch by Robin Templeton <robin@igalia.com>

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 evilpies@gmail.com: https://hg.mozilla.org/integration/autoland/rev/14459cfd1c7a Introduce Cu.isOpaqueWrapper. r=peterv https://hg.mozilla.org/integration/autoland/rev/e4b9d51c588d Remove Object.prototype.toString classname fallback. r=jwalden
Blocks: 1637078
Status: NEW → RESOLVED
Closed: 5 years 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.

Attachment

General

Created:
Updated:
Size: