tor-browser

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

test_HeapSnapshot_takeCensus_07.js (2466B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 "use strict";
      4 
      5 // HeapSnapshot.prototype.takeCensus breakdown: check error handling on property
      6 // gets.
      7 //
      8 // Ported from js/src/jit-test/tests/debug/Memory-takeCensus-07.js
      9 
     10 function run_test() {
     11  const g = newGlobal();
     12  const dbg = new Debugger(g);
     13 
     14  assertThrows(() => {
     15    saveHeapSnapshotAndTakeCensus(dbg, {
     16      breakdown: {
     17        get by() {
     18          throw Error("ಠ_ಠ");
     19        },
     20      },
     21    });
     22  }, "ಠ_ಠ");
     23 
     24  assertThrows(() => {
     25    saveHeapSnapshotAndTakeCensus(dbg, {
     26      breakdown: {
     27        by: "count",
     28        get count() {
     29          throw Error("ಠ_ಠ");
     30        },
     31      },
     32    });
     33  }, "ಠ_ಠ");
     34 
     35  assertThrows(() => {
     36    saveHeapSnapshotAndTakeCensus(dbg, {
     37      breakdown: {
     38        by: "count",
     39        get bytes() {
     40          throw Error("ಠ_ಠ");
     41        },
     42      },
     43    });
     44  }, "ಠ_ಠ");
     45 
     46  assertThrows(() => {
     47    saveHeapSnapshotAndTakeCensus(dbg, {
     48      breakdown: {
     49        by: "objectClass",
     50        get then() {
     51          throw Error("ಠ_ಠ");
     52        },
     53      },
     54    });
     55  }, "ಠ_ಠ");
     56 
     57  assertThrows(() => {
     58    saveHeapSnapshotAndTakeCensus(dbg, {
     59      breakdown: {
     60        by: "objectClass",
     61        get other() {
     62          throw Error("ಠ_ಠ");
     63        },
     64      },
     65    });
     66  }, "ಠ_ಠ");
     67 
     68  assertThrows(() => {
     69    saveHeapSnapshotAndTakeCensus(dbg, {
     70      breakdown: {
     71        by: "coarseType",
     72        get objects() {
     73          throw Error("ಠ_ಠ");
     74        },
     75      },
     76    });
     77  }, "ಠ_ಠ");
     78 
     79  assertThrows(() => {
     80    saveHeapSnapshotAndTakeCensus(dbg, {
     81      breakdown: {
     82        by: "coarseType",
     83        get scripts() {
     84          throw Error("ಠ_ಠ");
     85        },
     86      },
     87    });
     88  }, "ಠ_ಠ");
     89 
     90  assertThrows(() => {
     91    saveHeapSnapshotAndTakeCensus(dbg, {
     92      breakdown: {
     93        by: "coarseType",
     94        get strings() {
     95          throw Error("ಠ_ಠ");
     96        },
     97      },
     98    });
     99  }, "ಠ_ಠ");
    100 
    101  assertThrows(() => {
    102    saveHeapSnapshotAndTakeCensus(dbg, {
    103      breakdown: {
    104        by: "coarseType",
    105        get other() {
    106          throw Error("ಠ_ಠ");
    107        },
    108      },
    109    });
    110  }, "ಠ_ಠ");
    111 
    112  assertThrows(() => {
    113    saveHeapSnapshotAndTakeCensus(dbg, {
    114      breakdown: {
    115        by: "internalType",
    116        get then() {
    117          throw Error("ಠ_ಠ");
    118        },
    119      },
    120    });
    121  }, "ಠ_ಠ");
    122 
    123  do_test_finished();
    124 }