dom/tests/unit/test_bug465752.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/.
     4  */
     6 function run_test()
     7 {
     8   const ios = Components.classes["@mozilla.org/network/io-service;1"]
     9                         .getService(Components.interfaces.nsIIOService);
    10   const str = "javascript:10";
    11   var uri = ios.newURI(str, null, null);
    12   var uri2 = ios.newURI(str, null, null);
    13   const str2 = "http://example.org";
    14   var uri3 = ios.newURI(str2, null, null);
    15   do_check_true(uri.equals(uri));
    16   do_check_true(uri.equals(uri2));
    17   do_check_true(uri2.equals(uri));
    18   do_check_true(uri2.equals(uri2));
    19   do_check_false(uri3.equals(uri2));
    20   do_check_false(uri2.equals(uri3));
    22   var simple = Components.classes["@mozilla.org/network/simple-uri;1"]
    23                          .createInstance(Components.interfaces.nsIURI);
    24   simple.spec = str;
    25   do_check_eq(simple.spec, uri.spec);
    26   do_check_false(simple.equals(uri));
    27   do_check_false(uri.equals(simple));
    28 }

mercurial