js/src/tests/js1_8_5/extensions/findReferences-02.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 // Any copyright is dedicated to the Public Domain.
     2 // http://creativecommons.org/licenses/publicdomain/
     3 // Contributor: Jim Blandy
     5 if (typeof findReferences == "function") {
     6     (function f() {
     7          assertEq(referencesVia(arguments, 'callee', f), true);
     8      })();
    10     var o = ({});
    12     function returnHeavy(y) { eval(''); return function heavy() { return y; }; }
    13     assertEq(referencesVia(returnHeavy(o), 'fun_callscope; y', o), true);
    14     assertEq(referencesVia(returnHeavy(o), 'fun_callscope; shape; base; parent', this), true);
    16     function returnBlock(z) { eval(''); let(w = z) { return function block() { return w; }; }; }
    17     assertEq(referencesVia(returnBlock(o), 'fun_callscope; w', o), true);
    19     function returnWithObj(v) { with(v) return function withObj() { return u; }; }
    20     assertEq(referencesVia(returnWithObj(o), 'fun_callscope; type; type_proto', o), true);
    22     reportCompare(true, true);
    23 } else {
    24     reportCompare(true, true, "test skipped: findReferences is not a function");
    25 }

mercurial