Closed Bug 1654851 Opened 5 years ago Closed 5 years ago

Ensure Private Fields are preserved through transplatation

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
81 Branch
Tracking Status
firefox81 --- fixed

People

(Reporter: mgaudet, Assigned: mgaudet)

References

Details

Attachments

(1 file)

Private fields should be preserved when an object is transplanted.

As part of DOM node adoption they are transplanted, and their expando chains are copied over.

This copying uses JS_CopyPropertiesFrom, which until this patch, cannot see
private fields as they are excluded from property iteration. This patch adds
property iteration for private fields, and renames JS_CopyPropertiesFrom to
JS_CopyOwnPropertiesAndPrivateFields which is more accurate.

The users of this method are all doing object manipulation in ways where
preserving the copied private field is the better default.

In addition to testing DOM nodes explicitly, this patch also adds a jit-test
which uses transplantableObject to test similar things with FakeDOMObjects.

Assignee: nobody → mgaudet
Status: NEW → ASSIGNED
Pushed by mgaudet@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/eda366bce802 Correctly handle transplanting objects with private fields r=jorendorff,extension-reviewers,zombie

Made a quick fix for the eslint failures seen here:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=312762510&repo=autoland&lineNumber=508

These were "prettier" issues so they were fixed by running the lint tool on the file.

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: