Closed Bug 2037186 Opened 6 months ago Closed 6 months ago

Consider removing some of the transplanting APIs.

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
152 Branch
Tracking Status
firefox152 --- fixed

People

(Reporter: emilio, Assigned: jandem)

References

Details

Attachments

(5 external files)

After bug 2037172 some of the transplanting APIs like JS_CopyOwnPropertiesAndPrivateFields and co become unused except for the JS shell, which seems like it exposes them for fuzzing. Seems they come from bug 1403679. Anba do you know if these are safe to remove?

Flags: needinfo?(andrebargull)

That's exciting. I'm actively working on our transplanting code currently so I can look into this.

Flags: needinfo?(andrebargull) → needinfo?(jdemooij)

I think you just eliminated a major footgun: object transplant/swap involving native objects! The remaining transplant cases involve two proxies and that's easier to reason about. I also think we can simplify some code paths in JS_TransplantObject.

First we should add support for the transplant-WindowProxy case to newGlobal in the JS shell. After that I think we can remove transplantableObject.

Jan's plan is exactly what I'd have proposed: Support transplantable window proxies in the shell to cover the JS_TransplantObject call in TransplantObjectNukingXrayWaiver and then remove transplantableObject from the shell.

Depends on: 2037348
Assignee: nobody → jdemooij
Status: NEW → ASSIGNED

Initially the plan was to remove the shell builtin completely. However the WindowProxy
transplanting added in bug 2037348 is only a partial replacement because some operations
unwrap wrappers including window proxies. In the browser, RemoteObjectProxy is a non-wrapper
proxy that can be transplanted.

To ensure we don't lose coverage, this patch simplifies transplantableObject to only support
simple non-DOM proxy objects. This also means we don't have to rewrite some of the shell tests
that use it. Some other tests that only made sense for transplanting native objects were deleted.

We no longer support swapping a proxy with a smaller object.

Object fuses are only used for native objects and WatchProtoChangeImpl is a no-op
for proxy objects.

Flags: needinfo?(jdemooij)
Attachment #9584451 - Attachment description: Bug 2037186 part 2 - Change transplant/swap to only support proxies with the same AllocKind. r?jonco! → Bug 2037186 part 2 - Change transplant/swap to only support proxies and require matching AllocKinds. r?jonco!

Thank you for your ongoing work to improve testing of our weird DOM transplanting!

Blocks: 2038557
Blocks: 2038561
QA Whiteboard: [qa-triage-done-c153/b152]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: