tor-browser

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

bigTextNodes.js (1001B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 tests.set(
      6  "bigTextNodes",
      7  (function() {
      8    var garbage = [];
      9    var garbageIndex = 0;
     10    return {
     11      description: "var foo = [ textNode, textNode, ... ]",
     12 
     13      enabled: "document" in globalThis,
     14 
     15      load: N => {
     16        garbage = new Array(N);
     17      },
     18      unload: () => {
     19        garbage = [];
     20        garbageIndex = 0;
     21      },
     22 
     23      defaultGarbagePerFrame: "8",
     24      defaultGarbagePiles: "8",
     25 
     26      makeGarbage: N => {
     27        var a = [];
     28        var s = "x";
     29        for (var i = 0; i < 16; i++) {
     30          s = s + s;
     31        }
     32        for (var i = 0; i < N; i++) {
     33          a.push(document.createTextNode(s));
     34        }
     35        garbage[garbageIndex++] = a;
     36        if (garbageIndex == garbage.length) {
     37          garbageIndex = 0;
     38        }
     39      },
     40    };
     41  })()
     42 );