dom/bindings/parser/tests/test_stringifier.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 WebIDL
     3 def WebIDLTest(parser, harness):
     4     parser.parse("""
     5         interface TestStringifier {
     6           stringifier;
     7         };
     8     """)
    10     results = parser.finish()
    12     harness.ok(isinstance(results[0].members[0], WebIDL.IDLMethod),
    13                "Stringifer should be method")
    15     parser = parser.reset()
    17     threw = False
    18     try:
    19         parser.parse("""
    20             interface TestStringifier {
    21               stringifier;
    22               stringifier;
    23             };
    24         """)
    25         results = parser.finish()
    26     except:
    27         threw = True
    29     harness.ok(threw, "Should not allow two 'stringifier;'")
    31     parser = parser.reset()
    33     threw = False
    34     try:
    35         parser.parse("""
    36             interface TestStringifier {
    37               stringifier;
    38               stringifier DOMString foo();
    39             };
    40         """)
    41         results = parser.finish()
    42     except:
    43         threw = True
    45     harness.ok(threw, "Should not allow a 'stringifier;' and a 'stringifier()'")

mercurial