On Tue, Jun 5, 2018 at 7:50 AM, Paul Bone <pb...@mozilla.com> wrote:

> Could you explain (or point me to an explaination) of what Realms are for?
> I've gathered that they're a TC39 thing that's being added, maybe for
> security? but since they don't restrict references between realms the way
> compartments and CCWs do, maybe I'm mistaken?  Why add them?
>
> I expect the answer is in one of the references or almost-common knowledge,
> but I seem to have missed it, sorry.
>

Realms are a TC39 thing, but they're not new - a "realm" is just a global
object and things associated with it (for instance, each global object has
its own copy of Object.prototype and other builtin functions and
prototypes). See https://tc39.github.io/ecma262/#sec-code-realms

So if you have a website with 10 <iframe>s, there will be 11 global objects
and currently that means there must be 11 compartments. We're changing that
so there will still be 11 globals/realms, but it will be possible to have
less than 11 compartments because we will be able to group multiple
globals/realms in one compartment. This will eliminate CCW overhead and
that's why we're doing this.

There is a TC39 proposal to add APIs to create new realms etc, but that's
unrelated to this project (I only heard about that last week).

Jan
_______________________________________________
dev-tech-js-engine-internals mailing list
dev-tech-js-engine-internals@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to