js/src/tests/js1_8_5/regress/regress-610026.js

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /*
     3  * Any copyright is dedicated to the Public Domain.
     4  * http://creativecommons.org/licenses/publicdomain/
     5  */
     7 var expect = "pass";
     8 var actual;
    10 /*
    11  * We hardcode here that GenerateBlockId limits a program to 2^20 blocks. Start
    12  * with 2^19 blocks, then test 2^20 - 1 blocks, finally test the limit.
    13  */
    14 var s = "{}";
    15 for (var i = 0; i < 21; i++)
    16     s += s;
    18 try {
    19     eval(s);
    20     actual = "pass";
    21 } catch (e) {
    22     actual = "fail: " + e;
    23 }
    25 assertEq(actual, expect);
    27 s += s.slice(0, -2);
    29 try {
    30     eval(s);
    31     actual = "pass";
    32 } catch (e) {
    33     actual = "fail: " + e;
    34 }
    36 assertEq(actual, expect);
    38 s += "{}";
    40 try {
    41     eval(s);
    42     actual = "fail: expected InternalError: program too large";
    43 } catch (e) {
    44     actual = (e.message == "program too large") ? "pass" : "fail: " + e;
    45 }
    47 assertEq(actual, expect);
    49 reportCompare(0, 0, "ok");

mercurial