js/src/gdb/tests/test-prettyprinters.py

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 import mozilla.prettyprinters
     3 run_fragment('prettyprinters.implemented_types')
     5 def implemented_type_names(expr):
     6     v = gdb.parse_and_eval(expr)
     7     it = mozilla.prettyprinters.implemented_types(v.type)
     8     return [str(_) for _ in it]
    10 assert_eq(implemented_type_names('i'), ['int'])
    11 assert_eq(implemented_type_names('a'), ['A', 'int'])
    12 assert_eq(implemented_type_names('b'), ['B', 'A', 'int'])
    13 assert_eq(implemented_type_names('c'), ['C'])
    14 assert_eq(implemented_type_names('c_'), ['C_', 'C'])
    15 assert_eq(implemented_type_names('e'), ['E', 'C', 'D'])
    16 assert_eq(implemented_type_names('e_'), ['E_', 'E', 'C', 'D'])
    17 assert_eq(implemented_type_names('f'), ['F', 'C', 'D'])
    18 assert_eq(implemented_type_names('h'), ['H', 'F', 'G', 'C', 'D'])
    20 # Check that our pretty-printers aren't interfering with printing other types.
    21 assert_pretty('10', '10')
    22 assert_pretty('(void*) 0', '') # Because of 'set print address off'

mercurial