dom/tests/unit/test_bug465752.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/unit/test_bug465752.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,28 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.7 + */
     1.8 +
     1.9 +function run_test()
    1.10 +{
    1.11 +  const ios = Components.classes["@mozilla.org/network/io-service;1"]
    1.12 +                        .getService(Components.interfaces.nsIIOService);
    1.13 +  const str = "javascript:10";
    1.14 +  var uri = ios.newURI(str, null, null);
    1.15 +  var uri2 = ios.newURI(str, null, null);
    1.16 +  const str2 = "http://example.org";
    1.17 +  var uri3 = ios.newURI(str2, null, null);
    1.18 +  do_check_true(uri.equals(uri));
    1.19 +  do_check_true(uri.equals(uri2));
    1.20 +  do_check_true(uri2.equals(uri));
    1.21 +  do_check_true(uri2.equals(uri2));
    1.22 +  do_check_false(uri3.equals(uri2));
    1.23 +  do_check_false(uri2.equals(uri3));
    1.24 +
    1.25 +  var simple = Components.classes["@mozilla.org/network/simple-uri;1"]
    1.26 +                         .createInstance(Components.interfaces.nsIURI);
    1.27 +  simple.spec = str;
    1.28 +  do_check_eq(simple.spec, uri.spec);
    1.29 +  do_check_false(simple.equals(uri));
    1.30 +  do_check_false(uri.equals(simple));
    1.31 +}

mercurial