|
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 */ |
|
5 |
|
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)); |
|
21 |
|
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 } |