Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 Components.utils.import("resource://gre/modules/NetUtil.jsm");
3 const SIMPLEURI_SPEC = "data:text/plain,hello world";
4 const BLOBURI_SPEC = "blob:123456";
6 function do_info(text, stack) {
7 if (!stack)
8 stack = Components.stack.caller;
10 dump( "\n" +
11 "TEST-INFO | " + stack.filename + " | [" + stack.name + " : " +
12 stack.lineNumber + "] " + text + "\n");
13 }
15 function do_check_uri_neq(uri1, uri2)
16 {
17 do_info("Checking equality in forward direction...");
18 do_check_false(uri1.equals(uri2));
19 do_check_false(uri1.equalsExceptRef(uri2));
21 do_info("Checking equality in reverse direction...");
22 do_check_false(uri2.equals(uri1));
23 do_check_false(uri2.equalsExceptRef(uri1));
24 }
26 function run_test()
27 {
28 var simpleURI = NetUtil.newURI(SIMPLEURI_SPEC);
29 var fileDataURI = NetUtil.newURI(BLOBURI_SPEC);
31 do_info("Checking that " + SIMPLEURI_SPEC + " != " + BLOBURI_SPEC);
32 do_check_uri_neq(simpleURI, fileDataURI);
34 do_info("Changing the nsSimpleURI spec to match the nsFileDataURI");
35 simpleURI.spec = BLOBURI_SPEC;
37 do_info("Verifying that .spec matches");
38 do_check_eq(simpleURI.spec, fileDataURI.spec);
40 do_info("Checking that nsSimpleURI != nsFileDataURI despite their .spec matching")
41 do_check_uri_neq(simpleURI, fileDataURI);
42 }