js/src/jit-test/lib/referencesVia.js

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 function referencesVia(from, edge, to) {
     6     if (typeof findReferences !== 'function')
     7         return true;
     9     edge = "edge: " + edge;
    10     var edges = findReferences(to);
    11     if (edge in edges && edges[edge].indexOf(from) != -1)
    12         return true;
    14     // Be nice: make it easy to fix if the edge name has just changed.
    15     var alternatives = [];
    16     for (var e in edges) {
    17         if (edges[e].indexOf(from) != -1)
    18             alternatives.push(e);
    19     }
    20     if (alternatives.length == 0) {
    21         print("referent not referred to by referrer after all");
    22     } else {
    23         print("referent is not referenced via: " + uneval(edge));
    24         print("but it is referenced via:       " + uneval(alternatives));
    25     }
    26     print("all incoming edges, from any object:");
    27     for (var e in edges)
    28         print(e);
    29     return false;
    30 }

mercurial