Closed Bug 1482215 Opened 6 years ago Closed 5 years ago

invisibleToDebugger should be a property of compartments, not realms

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: jimb, Assigned: jimb)

References

Details

Attachments

(1 file, 1 obsolete file)

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
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)
I think I can get to this today.
Flags: needinfo?(jimb)
Assignee: nobody → jimb
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
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
Status: NEW → ASSIGNED
https://hg.mozilla.org/mozilla-central/rev/7e30c215f294
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: