Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Pull request Compare This branch is 3 commits ahead, 216 commits behind tvcutsem:master.
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

This is a shim for the ECMAScript-Harmony reflection module.

After loading reflect.js, the following methods/objects are patched to be able to recognize emulated direct proxies:


In addition, a global object Reflect is defined that houses the functions from the ES-Harmony reflect module.

The Reflect object defines Reflect.Proxy which implements direct proxies. To create a direct proxy, call:

var proxy = Proxy(target, handler)


The global Reflect object defines the following properties:

function Proxy(target : object, handler : object) -> object

function VirtualHandler() -> object

// each of the following functions corresponds
// one-to-one with a Proxy trap from the handler API
// (type? stands for type | undefined)

function getOwnPropertyDescriptor(target : object, name : string) -> object?

function defineProperty(target : object, name : string, desc : object) -> bool

function getOwnPropertyNames(target : object) -> array[string]

function deleteProperty(target : object, name : string) -> bool

function enumerate(target : object) -> array[string]

function iterate(target : object) -> iterator

function freeze(target : object) -> bool

function seal(target : object) -> bool

function preventExtensions(target : object) -> bool

function has(target : object, name : string) -> bool

function hasOwn(target : object, name : string) -> bool

function keys(target : object) -> array[string]

function get(target : object, name : string, receiver : object?) -> any

function set(target : object, name : string, value : any, receiver : object?) -> bool

function apply(target : object, receiver : object?, args : array) -> any

function construct(target : object, args : array) -> any


  • ECMAScript 5/strict
  • To emulate direct proxies:
    • old Harmony Proxies with non-standard support for passing through non-configurable properties
    • Harmony WeakMaps

Direct Proxy emulation tested on Firefox 8 and recent tracemonkey shells. The Reflect API was tested on Firefox 8, tracemonkey and v8 (3.7.6 or higher).

Next steps

  • Provide fallback behavior for part of the API, for environments without Proxy or WeakMap support.
  • More tests.
  • Switch to qunit or other unit testing framework.
  • Add example uses of proxies.
  • More detailed API description.
Something went wrong with that request. Please try again.