tor-browser

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

bug1209585.js (884B)


      1 // |jit-test| skip-if: helperThreadCount() === 0
      2 
      3 if ("gczeal" in this)
      4    gczeal(0);
      5 
      6 eval("g=function() {}")
      7 var lfGlobal = newGlobal();
      8 for (lfLocal in this) {
      9    if (!(lfLocal in lfGlobal)) {
     10        lfGlobal[lfLocal] = this[lfLocal];
     11    }
     12 }
     13 lfGlobal.offThreadCompileToStencil(`
     14 if (!("oomAtAllocation" in this && "resetOOMFailure" in this))
     15    gczeal(0);
     16 function oomTest(f) {
     17    var i = 1;
     18    do {
     19        try {
     20            oomAtAllocation(i);
     21            f();
     22            more = resetOOMFailure();
     23        } catch (e) {
     24            more = resetOOMFailure();
     25        }
     26        i++;
     27    } while(more);
     28 }
     29 var g = newGlobal();
     30 oomTest(function() { new revocable(); });
     31 `);
     32 try {
     33    var stencil = lfGlobal.finishOffThreadStencil();
     34    lfGlobal.evalStencil(stencil);
     35 } catch(e) {
     36    // This can happen if we OOM while bailing out in Ion.
     37    assertEq(e, "out of memory");
     38 }