Tue, 06 Jan 2015 21:39:09 +0100
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.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=462787 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 462787</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 10 | </head> |
michael@0 | 11 | <body> |
michael@0 | 12 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=462787">Mozilla Bug 462787</a> |
michael@0 | 13 | <p id="display"></p> |
michael@0 | 14 | <div id="content" style="display: none"> |
michael@0 | 15 | |
michael@0 | 16 | </div> |
michael@0 | 17 | <pre id="test"> |
michael@0 | 18 | <script type="application/javascript"> |
michael@0 | 19 | |
michael@0 | 20 | /** Test for Bug 462787 **/ |
michael@0 | 21 | |
michael@0 | 22 | function do_test() { |
michael@0 | 23 | const INVALID_POINTER = SpecialPowers.Cr.NS_ERROR_INVALID_POINTER; |
michael@0 | 24 | |
michael@0 | 25 | var utils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"] |
michael@0 | 26 | .getService(SpecialPowers.Ci.inIDOMUtils); |
michael@0 | 27 | try { |
michael@0 | 28 | utils.getCSSStyleRules(null); |
michael@0 | 29 | ok(false, "expected an exception"); |
michael@0 | 30 | } |
michael@0 | 31 | catch(e) { |
michael@0 | 32 | e = SpecialPowers.wrap(e); |
michael@0 | 33 | is(e.result, INVALID_POINTER, "got the expected exception"); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | try { |
michael@0 | 37 | utils.getRuleLine(null); |
michael@0 | 38 | ok(false, "expected an exception"); |
michael@0 | 39 | } |
michael@0 | 40 | catch(e) { |
michael@0 | 41 | e = SpecialPowers.wrap(e); |
michael@0 | 42 | is(e.result, INVALID_POINTER, "got the expected exception"); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | try { |
michael@0 | 46 | utils.isIgnorableWhitespace(null); |
michael@0 | 47 | ok(false, "expected an exception"); |
michael@0 | 48 | } |
michael@0 | 49 | catch(e) { |
michael@0 | 50 | e = SpecialPowers.wrap(e); |
michael@0 | 51 | is(e.result, INVALID_POINTER, "got the expected exception"); |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | try { |
michael@0 | 55 | utils.getParentForNode(null, true); |
michael@0 | 56 | ok(false, "expected an exception"); |
michael@0 | 57 | } |
michael@0 | 58 | catch(e) { |
michael@0 | 59 | e = SpecialPowers.wrap(e); |
michael@0 | 60 | is(e.result, INVALID_POINTER, "got the expected exception"); |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | try { |
michael@0 | 64 | utils.getBindingURLs(null); |
michael@0 | 65 | ok(false, "expected an exception"); |
michael@0 | 66 | } |
michael@0 | 67 | catch(e) { |
michael@0 | 68 | e = SpecialPowers.wrap(e); |
michael@0 | 69 | is(e.result, INVALID_POINTER, "got the expected exception"); |
michael@0 | 70 | } |
michael@0 | 71 | |
michael@0 | 72 | try { |
michael@0 | 73 | utils.getContentState(null); |
michael@0 | 74 | ok(false, "expected an exception"); |
michael@0 | 75 | } |
michael@0 | 76 | catch(e) { |
michael@0 | 77 | e = SpecialPowers.wrap(e); |
michael@0 | 78 | is(e.result, INVALID_POINTER, "got the expected exception"); |
michael@0 | 79 | } |
michael@0 | 80 | |
michael@0 | 81 | try { |
michael@0 | 82 | utils.setContentState(null, false); |
michael@0 | 83 | ok(false, "expected an exception"); |
michael@0 | 84 | } |
michael@0 | 85 | catch(e) { |
michael@0 | 86 | e = SpecialPowers.wrap(e); |
michael@0 | 87 | is(e.result, INVALID_POINTER, "got the expected exception"); |
michael@0 | 88 | } |
michael@0 | 89 | |
michael@0 | 90 | SimpleTest.finish(); |
michael@0 | 91 | } |
michael@0 | 92 | |
michael@0 | 93 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 94 | addLoadEvent(do_test); |
michael@0 | 95 | |
michael@0 | 96 | |
michael@0 | 97 | </script> |
michael@0 | 98 | </pre> |
michael@0 | 99 | </body> |
michael@0 | 100 | </html> |