Created
July 9, 2018 20:05
-
-
Save Gozala/0e46209d609e227124ca9e1da63dba97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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