-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formalize [[Realm]] internal slot of ordinary objects #573
Comments
So from my perspective the work here is:
I am pretty sure this is all layering work, and not observable purely within ES. But it would be good to discuss such a project with the larger community. |
We have had some internal discussions on this that I would like to start making public. I can't easily find all the relevant Chrome peoples' GitHub handles so I'll just send them a link. In the meantime, pinging @bzbarsky @bholley. Background information: realm/settings object/global are 1:1:1. See the spec if you are interested in more background reading. It is my understanding V8 and Blink would like to remove the [[Realm]] slot that all objects have (called "CreationContext" in V8), and leave it only with functions, and possibly platform objects. So the plan above, to formalize [[Realm]] for all objects, would be moving in the wrong direction. Right now, as far as I know, [[Realm]] needs to exist on all objects in order to correctly set up the entry concept. The entry concept is used in many places in various web specs, but we would like to get rid of it in favor of current and relevant. Some examples of places it is currently used are:
The reasoning why defining entry requires every JavaScript object to have a [[Realm]] is basically that when doing const o = { handleEvent: f };
addEventListener("foo", o); we want the entry realm to be that of With this in mind I see two options for allowing the Chrome team to get rid of the per-object [[Realm]] pointer:
We could do both of these in parallel, of course. |
I think you got all the relevant bits. To the extent that entry stuff is used for security checks of any sort, having it "wrong" is obviously bad. On the other hand, using entry in anything resembling security checks is a pretty suspect thing to do in general. For example, I think the frameElement definition is wrong and should use either incumbent or current settings (the differences between the two in this case are rather subtle if detectable at all; I'd have to think about whether they're detectable). I'm not sure why it uses entry.... That said, how would you tweak the definition to make
I think you're out of luck. Trying to get pretty much any sort of information out of You could try to change the entry global in this case to that of the Note that we would still need a Realm association on callable objects of all sorts, not just functions, for the main call itself. |
Note also that it would be really good to have someone from WebKit/JSC and Edge/Chakra involved in this conversation. |
Let's dupe this into the more recent #1333. |
Per @domenic all implementations already have this. The web platform uses this slot for certain security checks. whatwg/html#473 (comment) has a bunch of the details.
https://www.w3.org/Bugs/Public/show_bug.cgi?id=24652 is the issue for formalizing this in IDL, but since it appears that this is larger than platform objects this issue would logically supersede it.
(If we indeed add this, HTML will need to modify its structured clone algorithm as that assumes ordinary objects have two internal slots.)
The text was updated successfully, but these errors were encountered: