Skip to content

Instantly share code, notes, and snippets.

@Gozala
Created July 9, 2018 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gozala/0e46209d609e227124ca9e1da63dba97 to your computer and use it in GitHub Desktop.
Save Gozala/0e46209d609e227124ca9e1da63dba97 to your computer and use it in GitHub Desktop.
const refs = new WeakMap()
function requestSomeAPI() {
const api = Cu.cloneInto({
doPrivilegedThing() {
refs.get(this).doPrivilegedThing()
}
}, unprivilegedContext)
refs.set(api, new Privileged())
return api
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment