tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

S15.2.3.6_A1.js (1146B)


      1 // Copyright 2011 Google Inc.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 info: |
      6    If a particular API exists (document.createElement, as happens to
      7    exist in a browser environment), check if the form objects it makes
      8    obey the constraints that even host objects must obey. In this
      9    case, that if defineProperty seems to have successfully installed a
     10    non-configurable getter, that it is still there.
     11 es5id: 15.2.3.6_A1
     12 description: Do getters on HTMLFormElements disappear?
     13 ---*/
     14 
     15 function getter() {
     16  return 'gotten';
     17 }
     18 
     19 if (typeof document !== 'undefined' &&
     20  typeof document.createElement === 'function') {
     21  var f = document.createElement("form");
     22  var refused = false;
     23  try {
     24    Object.defineProperty(f, 'foo', {
     25      get: getter,
     26      set: void 0
     27    });
     28  } catch (err) {
     29    // A host object may refuse to install the getter
     30    refused = true;
     31  }
     32  if (!refused) {
     33    var desc = Object.getOwnPropertyDescriptor(f, 'foo');
     34    assert.sameValue(desc.get, getter, 'The value of desc.get is expected to equal the value of getter');
     35  }
     36 }
     37 
     38 reportCompare(0, 0);