tor-browser

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

throws-when-false.js (674B)


      1 // Copyright (C) 2019 Ecma International. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-object.seal
      6 description: >
      7  Object.seal throws if SetIntegrityLevel(O, sealed) returns false.
      8 info: |
      9  Object.seal ( O )
     10  ...
     11  2. Let status be ? SetIntegrityLevel(O, sealed).
     12  3. If status is false, throw a TypeError exception.
     13 
     14  SetIntegrityLevel ( O, level )
     15  ...
     16  3. Let status be ? O.[[PreventExtensions]]().
     17  4. If status is false, return false.
     18 ---*/
     19 
     20 const p = new Proxy({}, {
     21  preventExtensions() {
     22    return false;
     23  },
     24 });
     25 
     26 assert.throws(TypeError, () => {
     27  Object.seal(p);
     28 });
     29 
     30 reportCompare(0, 0);