function getHiddenRecord(key) {
    if (key !== Object(key)) {
      throw new TypeError('Not an object: ' + key);
    }
    var hiddenRecord = key[HIDDEN_NAME];
    if (hiddenRecord && hiddenRecord.key === key) { return hiddenRecord; }
    if (!isExtensible(key)) {
      // Weak map must brute force, as explained in doc-comment above.
      return void 0;
    }

    // The hiddenRecord and the key point directly at each other, via
    // the "key" and HIDDEN_NAME properties respectively. The key
    // field is for quickly verifying that this hidden record is an
    // own property, not a hidden record from up the prototype chain.
    //
    // NOTE: Because this WeakMap emulation is meant only for systems like
    // SES where Object.prototype is frozen without any numeric
    // properties, it is ok to use an object literal for the hiddenRecord.
    // This has two advantages:
    // * It is much faster in a performance critical place
    // * It avoids relying on Object.create(null), which had been
    //   problematic on Chrome 28.0.1480.0. See
    //   https://code.google.com/p/google-caja/issues/detail?id=1687
    hiddenRecord = { key: key };

    // When using this WeakMap emulation on platforms where
    // Object.prototype might not be frozen and Object.create(null) is
    // reliable, use the following two commented out lines instead.
    // hiddenRecord = Object.create(null);
    // hiddenRecord.key = key;

    // Please contact us if you need this to work on platforms where
    // Object.prototype might not be frozen and
    // Object.create(null) might not be reliable.

    try {
      defProp(key, HIDDEN_NAME, {
        value: hiddenRecord,
        writable: false,
        enumerable: false,
        configurable: false
      });
      return hiddenRecord;
    } catch (error) {
      // Under some circumstances, isExtensible seems to misreport whether
      // the HIDDEN_NAME can be defined.
      // The circumstances have not been isolated, but at least affect
      // Node.js v0.10.26 on TravisCI / Linux, but not the same version of
      // Node.js on OS X.
      return void 0;
    }
  }
<p>To treat objects as identity-keys with reasonable efficiency
on ES5 by itself (i.e., without any object-keyed collections), we
need to add a hidden property to such key objects when we
can. This raises several issues:
<ul>
<li>Arranging to add this property to objects before we lose the
    chance, and
<li>Hiding the existence of this new property from most
    JavaScript code.
<li>Preventing <i>certification theft</i>, where one object is
    created falsely claiming to be the key of an association
    actually keyed by another object.
<li>Preventing <i>value theft</i>, where untrusted code with
    access to a key object but not a weak map nevertheless
    obtains access to the value associated with that key in that
    weak map.
</ul>
We do so by
<ul>
<li>Making the name of the hidden property unguessable, so "[]"
    indexing, which we cannot intercept, cannot be used to access
    a property without knowing the name.
<li>Making the hidden property non-enumerable, so we need not
    worry about for-in loops or {@code Object.keys},
<li>monkey patching those reflective methods that would
    prevent extensions, to add this hidden property first,
<li>monkey patching those methods that would reveal this
    hidden property.
</ul>
Unfortunately, because of same-origin iframes, we cannot reliably
add this hidden property before an object becomes
non-extensible. Instead, if we encounter a non-extensible object
without a hidden record that we can detect (whether or not it has
a hidden record stored under a name secret to us), then we just
use the key object itself to represent its identity in a brute
force leaky map stored in the weak map, losing all the advantages
of weakness for these.