invisibleToDebugger should be a property of compartments, not realms

RESOLVED FIXED in Firefox 66

Status

()

enhancement
P3
normal
RESOLVED FIXED
10 months ago
5 months ago

People

(Reporter: jimb, Assigned: jimb)

Tracking

unspecified
mozilla66
Points:
---

Firefox Tracking Flags

(firefox66 fixed)

Details

Attachments

(1 attachment, 1 obsolete attachment)

Assignee

Description

10 months ago
At the moment, the invisibleToDebugger flag is a property of individual realms, but this is very difficult to work with, as inter-realm edges are very common, meaning that Debugger operations that retrieve almost any value from the debuggee should be fallible.

Previously, the invisibleToDebugger flag was associated with compartments, so that only Debugger.Object.prototype.unwrap needed to be fallible in order to enforce it. We should move the flag back to compartments.

Fortunately, all uses of JS::RealmCreationOptions::setInvisibleToDebugger also request a fresh compartment, so this should not affect any users of the API.
Priority: -- → P3
Assignee

Comment 1

5 months ago
jandem says that this should make it possible to remove the last use of JSObject::deprecatedRealm, found in Debugger. I've forgotten some of the details of this patch, but when I rebase it I'll make sure that removal makes sense, and include it in the patch.
See Also: → 1482082
Please let me know if you can't get to this soon and I can do this.
Flags: needinfo?(jimb)
Assignee

Comment 3

5 months ago
I think I can get to this today.
Flags: needinfo?(jimb)
Assignee

Updated

5 months ago
Assignee: nobody → jimb
Assignee

Comment 6

5 months ago
The final remaining code that assumes that every object is associated with a
global is in the Debugger API: Debugger.Object.prototype.unwrap consults the
unwrapped object's global to see whether it is about to reveal an object that it
must not.

This patch:

- adds an `invisibleToDebugger` flag to JS::Compartment, and sets it from the
  Realm options (since there is no API for creating compartments directly; only
  the act of creating a Realm can create a compartment to hold it);

- asserts that new realms added to a compartment have a compatible visibility; and

- has the shell primitive for creating realms throw an error in case of
  incompatibility, rather than crashing.
Attachment #9031724 - Attachment is obsolete: true
Attachment #9031590 - Attachment description: Bug 1482215: Ensure compartments never contain a mix of visible and invisible realms. r?jorendorff → Bug 1482215: Make Debugger visibility per-Compartment, and ensure realms match their compartments.
Attachment #9031590 - Attachment description: Bug 1482215: Make Debugger visibility per-Compartment, and ensure realms match their compartments. → Bug 1482215: Make Debugger visibility per-Compartment, and ensure realms match their compartments. r?jorendorff

Comment 7

5 months ago
Pushed by jblandy@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7e30c215f294
Make Debugger visibility per-Compartment, and ensure realms match their compartments. r=jorendorff
Assignee

Updated

5 months ago
Duplicate of this bug: 1494146
Assignee

Updated

5 months ago
Status: NEW → ASSIGNED

Comment 9

5 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/7e30c215f294
Status: ASSIGNED → RESOLVED
Last Resolved: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.