Bug 1796551 [wpt PR 36570] - WebKit export of https://bugs.webkit.org/show_bug.cgi...
[gecko.git] / netwerk / test / unit / test_aboutblank.js
blob2d5c92f095298f9bc536891eb8e65cc9616b74f4
1 "use strict";
3 function run_test() {
4   var base = NetUtil.newURI("http://www.example.com");
5   var about1 = NetUtil.newURI("about:blank");
6   var about2 = NetUtil.newURI("about:blank", null, base);
8   var chan1 = NetUtil.newChannel({
9     uri: about1,
10     loadUsingSystemPrincipal: true,
11   }).QueryInterface(Ci.nsIPropertyBag2);
13   var chan2 = NetUtil.newChannel({
14     uri: about2,
15     loadUsingSystemPrincipal: true,
16   }).QueryInterface(Ci.nsIPropertyBag2);
18   var haveProp = false;
19   var propVal = null;
20   try {
21     propVal = chan1.getPropertyAsInterface("baseURI", Ci.nsIURI);
22     haveProp = true;
23   } catch (e) {
24     if (e.result != Cr.NS_ERROR_NOT_AVAILABLE) {
25       throw e;
26     }
27     // Property shouldn't be there.
28   }
29   Assert.equal(propVal, null);
30   Assert.equal(haveProp, false);
31   Assert.equal(chan2.getPropertyAsInterface("baseURI", Ci.nsIURI), base);