1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 function standardMutator() {
9 return Cc
["@mozilla.org/network/standard-url-mutator;1"].createInstance(
14 add_task(async
function test_simple_setter_chaining() {
15 let uri
= standardMutator()
16 .setSpec("http://example.com/")
21 equal(uri
.spec
, "ftp://example.com/?hello#bla");
24 add_task(async
function test_qi_behaviour() {
25 let uri
= standardMutator()
26 .setSpec("http://example.com/")
27 .QueryInterface(Ci
.nsIURI
);
28 equal(uri
.spec
, "http://example.com/");
32 uri
= standardMutator().QueryInterface(Ci
.nsIURI
);
35 "mutator doesn't QI if it holds no URI"
38 let mutator
= standardMutator().setSpec("http://example.com/path");
39 uri
= mutator
.QueryInterface(Ci
.nsIURI
);
40 equal(uri
.spec
, "http://example.com/path");
43 uri
= mutator
.QueryInterface(Ci
.nsIURI
);
46 "Second QueryInterface should fail"