Closed Bug 1277801 Opened 4 years ago Closed 20 days 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

(Keywords: site-compat)

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

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: 20 days ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
You need to log in before you can comment on or make changes to this bug.