User:Jorend/compartments

From MozillaWiki
Jump to: navigation, search

6 slides total (blah)

Ideally, just the heading would appear at first, and each bullet point would appear when I push a button or something.

What do I need to know about compartments?

  - Hopefully nothing.

  - When using C++, don't cross the streams.

What are compartments?

  - Regions of memory...

  - where JS objects, strings, and code live...

  - accessed by only one thread at a time...

  - within which no security rules need to be enforced.

What problems are we solving with compartments?

  - GC pauses

  - Security checks

  - Locking in the JS engine

What are the new APIs?

    No.

What are the new APIs?

  - JS_NewCompartmentAndGlobalObject(cx, clasp)

  - JS_EnterCrossCompartmentCall(cx, obj) -> call
    JS_LeaveCrossCompartmentCall(call)

  - JS_GetCompartmentPrivate(cx, compartment)
    JS_SetCompartmentPrivate(cx, compartment, x)
    JS_SetCompartmentHook(rt, hook)

  - ...and lots of new assertions

Why not cross the streams?

    That would be Bad.